Answers for "simple kick command discord.js v12"

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
0

simple kick command discord.js v12

ban someone discord jsJavascript By Lime on Jun 21 2020
if (!message.member.hasPermission("BAN_MEMBERS")) return message.channel.send("Invalid Permissions")
let User = message.guild.member(message.mentions.users.first()) || message.guild.members.get(args[0])
if (!User) return message.channel.send("Invalid User")
if (User.hasPermission("BAN_MEMBERS")) return message.reply("Invalid Permissions")
let banReason = args.join(" ").slice(22);
if (!banReason) {
  banReason = "None"
}

User.ban({reason: banReason})
Posted by: Guest on August-25-2020

Code answers related to "Javascript"

Browse Popular Code Answers by Language