Skip to content

discord.js problem: How can I implement a command that will only allow people with the kick and administrator permission to use the command

I used this command for kicks, but everyone in the server can now kick. I just want to add something that will only allow people with the admin and kick permissions to use it.

module.exports = {
    name: 'kick',
    description: "This command kicks a member!",
    execute(message, args){
        const target = message.mentions.users.first();
            const memberTarget = message.guild.members.cache.get(;
  "User has been kicked");
  `error. solution; please specify one person to kick, maybe that person has higher permissions than me and you`);



You have to implement something like

if(!message.member.hasPermission("ADMINISTRATOR") && 
!message.member.hasPermission("KICK_MEMBERS")) return"You don't 
have permission to kick a member");

at the beginning of your kick command code.