Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

191
Views
How to get role permissions ? Discord.js

I'm trying to make a bot that analyzes the server to find a flaw but I can't find how to know a precise authorization for a role? I have already tested this:

var role = message.mentions.roles.first()

if(role.permissions.has(Discord.Permissions.FLAGS.KICK_MEMBERS)){
     message.reply("YES") 
}
else message.reply("NO")

I always receive Yes as a message

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

You are doing the if/else wrong, instead do it like this:

var role = message.mentions.roles.first()

if (role.permissions.has(Permissions.FLAGS.KICK_MEMBERS)) {
    message.reply({ content: "YES" })
} else {
    message.reply({ content: "NO" })
}

You don't need to put Discord infront of Permissions, and message.reply('') is deprecated, instead use message.reply({ content: '' })

 Old: channel.send(embed);
 New: channel.send({ embeds: [embed, embed2] });

 Old: channel.send('Hello!', { embed });
 New: channel.send({ content: 'Hello!', embeds: [embed, embed2] });

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!