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 BanCommand extends BaseCommand {
- constructor() {
- super('ban', 'Moderation', []);
- }
- async run(client, message, args) {
- if(!message.member.hasPermission("BAN_MEMBERS")) return message.channel.send("You do not have the permissions to use this command.");
- if(!message.guild.me.hasPermission("BAN_MEMBERS")) return message.channel.send("I dont have the ban permission.")
- let reason =args.slice(1).join(" ");
- const mentionedMember = message.mentions.members.first();
- if (!reason) reason = 'No reason given.';
- if (!args[0]) return message.channel.send('You must state someone to ban. `\`+ban @user reason\`');
- if (!mentionedMember) return message.channel.send('The member mentioned is not in the server.');
- const banEmbed = new Discord.MessageEmbed()
- .setTitle(`You have been banned from ${message.guild.name}`)
- .setDescription(`Reason for being banned: ${reason}`)
- .setColor("#00a170")
- .setTimestamp();
- await mentionedMember.send(banEmbed).catch(err => console.log(err));
- await mentionedMember.ban({
- days: 7,
- reason: reason
- }).catch(err => console.log(err)).then(() => message.channel.send("Successfully banned"+ mentionedMember.user.tag));
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement