Permissions help with kick/ban command

If I want to kick/ban someone, I don’t want to let anyone without the permissions to be able to kick or ban the people. How would I make it so only people with specific permissions can do this.

@Krxvee, are you talking about kick/banning people using your bot with Discord.js?

Yeh, like on glitch.

In your kick/ban command, you could check whether the user has a certain role like this:

if (message.content.startsWith(prefix + "ban")) {
   // check if user has the role
   if (message.member.roles.some(role => === 'SOME ROLE')) {
       // the kick/ban code here
   } else {"You do not have sufficient permissions to run this command!");


You could create a particular role that can do the kick/ban command and give it to whichever user you want.

Hi @Krxvee,

I had this question before and managed to solve it!
What you need to do is this

if (!message.member.hasPermission(“BAN_MEMBERS”)) return message.reply(‘You dont have permission to ban people…’);

Replace BAN_MEMBERS to what ever permission it needs.

Hope this Helps! :grinning:

EDIT: If you are using Discord.js v13 then use this:

if (!message.member.permissions.has(“Permissions.FLAGS.BAN_MEMBERS”)) return message.reply(“No Permission!”)


Thank you all for this help :smile:

This forum is for Glitch related support and help.

For any discord related support and help please read the Discord.js docs or join the Discord.js server so that the forum remains on topic.

Just informed this because there is already an entire documentation and 
support server for discord issues!

@Froosty, the Glitch Forum is not only meant for Glitch related support and help, but also for coding-related queries. Anyone is welcome to ask for support related to coding, including Discord. In fact, we even have a category for that: #coding-help.

Yeah I get the point.

But my concern is that it will be easier for one to get help faster and more accurate help from the discord.js community itself…

Not when you don’t know what you’re looking for and how you should be doing it.

hey i need your help i need you to show me command only for Kick members for discord bot can you show me?

this dosen’t works