discord.js command permissions for role code example
Example 1: how to give roles discord.js
let role = message.guild.roles.find(r => r.name === "Role Name");
let member = message.mentions.members.first();
member.roles.add(role)
Example 2: permissions discord.js
if (member.hasPermission('KICK_MEMBERS')) {
console.log('This member can kick');
}
if (member.hasPermission(['KICK_MEMBERS', 'BAN_MEMBERS'])) {
console.log('This member can kick and ban');
}
if (member.hasPermission('KICK_MEMBERS', { checkAdmin: false, checkOwner: false })) {
console.log('This member can kick without allowing admin to override');
}