If user has higher role than bot

Currently i have this code:
let targetMember =
message.mentions.members?.first()
let targetMember =
message.mentions.members?.first()
how can i check if the bot has a lower role than targetMember?
6 Replies
d.js toolkit
d.js toolkit2y ago
- What's your exact discord.js npm list discord.js and node node -v version? - Not a discord.js issue? Check out #other-js-ts. - Consider reading #how-to-get-help to improve your question! - Explain what exactly your issue is. - Post the full error stack trace, not just the top part! - Show your code! - Issue solved? Press the button!
adam
adamOP2y ago
Latest discord.js
Squid
Squid2y ago
Compare targetMember.roles.highest.position to message.guild.members.me.roles.highest.position
adam
adamOP2y ago
so if(targetMember.roles.highest.position >= message.guild.members.me.roles.highest.position) correct?
Squid
Squid2y ago
That would check if the mentioned member's highest role is above the bot member's highest role
adam
adamOP2y ago
oh so opposite <= Got it solved thanks a lot !
Want results from more Discord servers?
Add your server