Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const BaseCommand = require('../../utils/structures/BaseCommand');
- const discord = require,{'discord.js'}
- module.exports = class KickCommand extends BaseCommand {
- constructor() {
- super('kick', 'moderation', []);
- }
- async run(client, message, args) {
- if (!message.member.hasPermission("KICK_MEMBERS")) return message.channel.send("You cannot use this command.");
- const mentionedMember = message.channel.mentions.members.first();
- let reason = args.sliced(1).join(' ');
- if (!reason) reason = "No reason specified.";
- const kickEmbed = new Discord.MessageEmbed()
- .setTitle(`You were kicked from ${message.guild.name}`)
- .setDescription(`Reason: ${reason}`)
- .setColor("#5708ab")
- .setTimestamp()
- .setFooter(client.user.tag, client.user.displayAvatar());
- // gb/kick
- if (!args[0]) return message.channel.send("You need to state a user to kick. \`gb/kick @user reason\`")
- if (!mentionedMember) return message.channel.send("The user mentioned isnt in the server, and thats not an epic gamer moment.")
- try{
- } catch (err){
- console.log("I was unable to message the member");
- console.log("Error below");
- console.log(err);
- }
- try{
- await mentionedMember.kick(reason)
- } catch (err){
- console.log("There was an error running the kick command");
- console.log("Error below");
- console.log(err);
- return message.channel.send("I was unable to kick the member.");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement