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.mentions.member.first();
- let reason = args.slice(1).join(" ");
- if (!reason) reason = "No reason given";
- const kickEmbed = new Discord.MessageEmbed()
- .setTitle(`You were kicked from ${message.guild.name}`)
- .setDescription(`Reason: ${reason}`)
- .setColor("#00a170")
- .setTimestamp()
- .setFooter(client.user.tag, client.user.displayAvatarURL())
- //+kick @user dm ads
- 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 mentionMember.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.channel.send("I was unable to kick the mentioned member.")
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement