I was making Permissions Handler and I get the error "TypeError: message.member.hasPermission is not a function". What's my mistake?
const validPermissions = [
"CREATE_INSTANT_INVITE",
"KICK_MEMBERS",
"BAN_MEMBERS",
"ADMINISTRATOR",
"MANAGE_CHANNELS",
"MANAGE_GUILD",
]
if(command.permissions.length){
let invalidPerms = []
for(const perm of command.permissions){
if(!validPermissions.includes(perm)){
return console.log(`Invalid Permissions ${perm}`);
}
if(!message.member.hasPermission(perm)){
invalidPerms.push(perm);
}
}
if (invalidPerms.length){
return message.channel.send(`Missing Permissions: \`${invalidPerms}\``);
}
message.member.hasPermission is not a function
. Check what exactly ismessage.member.hasPermission
(or post it here)discord.js
says in the change log GuildMember#hasPermission:…The GuildMember#hasPermission shortcut/helper method has been removed.…
are you sure thathasPermission
exists formember
for the version ofdiscord.js
you use?