简体   繁体   中英

Check if bot has a higher role than the role (Discord.js)

I am making a giverole command, so like,giverole {member} {role}. but how do I know if the bot highest role is higher than the mentioned role, I haven't tried anything yet because I am stuck. please help me.

I am using discord.js v12

I don't know how your code looks like but an easy way to check if the role is higher than the bot is to see if the role is editable by the bot! if(.role.editable) return message.channel:send(":x; **I do not have the permission to use this command!**");

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM