Home > Software design >  How to check if the mentioned participant has rights Discord.js
How to check if the mentioned participant has rights Discord.js

Time:07-13

I'm trying to check if the mentioned member has admin rights, but I only know the option with the author of the post

message.member.permissions.has("BAN_MEMBERS")

Is there another option?

CodePudding user response:

I'm not entirely sure but if your issue is checking to see if they have admin or finding that was mentioned, but just for checking to see if they have admin you can use

<user>.permissions.has("ADMINISTRATOR");

If your issue was finding the user that was mentioned, you can use skara9's solution of

message.mentions.members.first()?.permissions.has("BAN_MEMBERS");

The ?. allows it to not throw an error if no user was mentioned.

You could combine both with

message.mentions.members.first()?.permissions.has("ADMINISTRATOR");
  • Related