Answers for "discord.js kick command with reason command handler"

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

Code answers related to "discord.js kick command with reason command handler"

Code answers related to "Javascript"

Browse Popular Code Answers by Language