Advertisement
YoJxsn

Untitled

Nov 12th, 2020
54
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. module.exports = class BanCommand extends BaseCommand {
  4. constructor() {
  5. super('ban', 'Moderation', []);
  6. }
  7.  
  8. async run(client, message, args) {
  9. if(!message.member.hasPermission("BAN_MEMBERS")) return message.channel.send("You do not have the permissions to use this command.");
  10. if(!message.guild.me.hasPermission("BAN_MEMBERS")) return message.channel.send("I dont have the ban permission.")
  11. let reason =args.slice(1).join(" ");
  12. const mentionedMember = message.mentions.members.first();
  13. if (!reason) reason = 'No reason given.';
  14. if (!args[0]) return message.channel.send('You must state someone to ban. `\`+ban @user reason\`');
  15. if (!mentionedMember) return message.channel.send('The member mentioned is not in the server.');
  16. const banEmbed = new Discord.MessageEmbed()
  17. .setTitle(`You have been banned from ${message.guild.name}`)
  18. .setDescription(`Reason for being banned: ${reason}`)
  19. .setColor("#00a170")
  20. .setTimestamp();
  21.  
  22.  
  23.  
  24. await mentionedMember.send(banEmbed).catch(err => console.log(err));
  25. await mentionedMember.ban({
  26. days: 7,
  27. reason: reason
  28. }).catch(err => console.log(err)).then(() => message.channel.send("Successfully banned"+ mentionedMember.user.tag));
  29. }
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement