Reputation: 308
I'm having trouble with one of my bots, I want to check if the bot role above other roles, I tried
message.guild.roles.array()
and yeah, it did work. However, it wasn't in the correct order and I couldn't check if the role was above another. Can anyone tell me how to check if the bot role is above other roles? Thanks.
Upvotes: 2
Views: 5397
Reputation: 308
I found out I didn't want to go through all the roles, so I just checked the positions of the 2 roles I am comparing
let role = message.mentions.roles.first();
let botrole = message.guild.roles.find("name", "Mobile Friendly")
if(role.position > botrole.position){
return await message.channel.send("I can't access that role, place me above other roles that you want me to manage.")
}
Upvotes: 3