Hi im trying to make a ban command but I want it so if you try to ban a member above the bots role it doesn't get a error please help discord.js v12
CodePudding user response:
You need to check the bot and the member's highest role position, and return
if the member has a higher role.
Assuming the member you want to ban is stored in a variable called member
:
if(member.roles.highest.position > message.guild.me.roles.highest.position) {
return message.channel.send("This member has a role higher than mine!");
}