Answers for ".kick() discord.js"

0

discord.js kick command

//start by defining discord.js
const Discord = require('discord.js');

//command handlers
exports.run = async (client, message, args) => {
  if (!message.member.hasPermission('KICK_MEMBERS')) return message.reply('You cannot kick members')
  
  let member = message.mentions.members.first()
  if (!member) return message.reply('Please specify a member for me to kick them')
  let reason = let reason = args.slice(1).join(" ");
  if (!reason) reason = 'No Reason Given';
  if (!member.kickable) return message.reply('This member is not kickable')
  
  member.kick(reason).catch(err => console.log(err));
}
Posted by: Guest on June-14-2021
-1

kick commands discord.js

if (msg.member.hasPermission("KICK_MEMBERS")) {
    if (msg.members.mentions.first()) {
        try {
            msg.members.mentions.first().kick();
        } catch {
            msg.reply("I do not have permissions to kick " + msg.members.mentions.first());
        }
    } else {
        msg.reply("You do not have permissions to kick " + msg.members.mentions.first());
    }
}
Posted by: Guest on January-12-2021

Code answers related to "Javascript"

Browse Popular Code Answers by Language