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 toolkit16mo 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
adamOP16mo ago
Latest discord.js
Squid
Squid16mo ago
Compare targetMember.roles.highest.position to message.guild.members.me.roles.highest.position
adam
adamOP16mo ago
so if(targetMember.roles.highest.position >= message.guild.members.me.roles.highest.position) correct?
Squid
Squid16mo ago
That would check if the mentioned member's highest role is above the bot member's highest role
adam
adamOP16mo ago
oh so opposite <= Got it solved thanks a lot !
Want results from more Discord servers?
Add your server