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 toolkit11mo 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
adam11mo ago
Latest discord.js
Squid
Squid11mo ago
Compare targetMember.roles.highest.position to message.guild.members.me.roles.highest.position
adam
adam11mo ago
so if(targetMember.roles.highest.position >= message.guild.members.me.roles.highest.position) correct?
Squid
Squid11mo ago
That would check if the mentioned member's highest role is above the bot member's highest role
adam
adam11mo ago
oh so opposite <= Got it solved thanks a lot !