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 can't use this command.");
- const mentionedMember = message.mentions.members.first();
- let reason = args.slice(1).join(" ");
- if (!reason) reason = "No reason given";
- const kickEmbed = new Discord.MessgageEmbed()
- .setTitle(`You were kicked from ${message.guild.name}`)
- .setDescription(`Reason: ${reason}`)
- .setColor("#5708ab")
- .setTimestamp()
- .setFooter(client.user.tag, client.user.displayAvatarURL())
- // ?kick @user
- if (!args[0]) return message.channel.send("You need to state a user to kick. \`-kick @user reason\`");
- if (!mentionedMember) return message.channel.send("The member mentioned is not in the server.");
- try {
- await mentionedMember.send(kickEmbed);
- } catch (err) {
- console.log('I was unable to message the member.');
- }
- try {
- await mentionedMember.kick(reason)
- } catch (err) {
- console.log(err);
- return message.chanel.send("I was unable to kick the member mentioned.")
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement