DoingGoodHelping

Untitled

Jan 11th, 2021
671
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. const BaseCommand = require('../../utils/structures/BaseCommand');
  2. const discord = require,{'discord.js'}
  3.  
  4. module.exports = class KickCommand extends BaseCommand {
  5.   constructor() {
  6.     super('kick', 'moderation', []);
  7.   }
  8.  
  9.   async run(client, message, args) {
  10.     if (!message.member.hasPermission("KICK_MEMBERS")) return message.channel.send("You cannot use this command.");
  11.     const mentionedMember = message.channel.mentions.members.first();
  12.     let reason = args.sliced(1).join(' ');
  13.     if (!reason) reason = "No reason specified.";
  14.     const kickEmbed = new Discord.MessageEmbed()
  15.       .setTitle(`You were kicked from ${message.guild.name}`)
  16.       .setDescription(`Reason: ${reason}`)
  17.       .setColor("#5708ab")
  18.       .setTimestamp()
  19.       .setFooter(client.user.tag, client.user.displayAvatar());
  20.  
  21.       // gb/kick
  22.       if (!args[0]) return message.channel.send("You need to state a user to kick. \`gb/kick @user reason\`")
  23.       if (!mentionedMember) return message.channel.send("The user mentioned isnt in the server, and thats not an epic gamer moment.")
  24.       try{
  25.  
  26.  
  27.       } catch (err){
  28.         console.log("I was unable to message the member");
  29.         console.log("Error below");
  30.         console.log(err);
  31.       }
  32.  
  33.       try{
  34.         await mentionedMember.kick(reason)
  35.       } catch (err){
  36.         console.log("There was an error running the kick command");
  37.         console.log("Error below");
  38.         console.log(err);
  39.         return message.channel.send("I was unable to kick the member.");
  40.       }
  41.   }
  42. }
RAW Paste Data