Advertisement
cheesyy

Untitled

Nov 11th, 2020
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.35 KB | None | 0 0
  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 can't use this command.");
  11. const mentionedMember = message.mentions.members.first();
  12. let reason = args.slice(1).join(" ");
  13. if (!reason) reason = "No reason given";
  14. const kickEmbed = new Discord.MessgageEmbed()
  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.displayAvatarURL())
  20.  
  21. // ?kick @user
  22. if (!args[0]) return message.channel.send("You need to state a user to kick. \`-kick @user reason\`");
  23. if (!mentionedMember) return message.channel.send("The member mentioned is not in the server.");
  24. try {
  25. await mentionedMember.send(kickEmbed);
  26. } catch (err) {
  27. console.log('I was unable to message the member.');
  28. }
  29.  
  30. try {
  31. await mentionedMember.kick(reason)
  32. } catch (err) {
  33. console.log(err);
  34. return message.chanel.send("I was unable to kick the member mentioned.")
  35. }
  36. }
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement