how to check if author of message has perms discord code example
Example 1: if member has role discord.js
let allowedRole = message.guild.roles.find("name", "rolename");
if (message.member.roles.has(allowedRole.id) {
} else {
})
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');
}