Haha-Yes/commands/admin/ban.js

37 lines
1.4 KiB
JavaScript
Raw Normal View History

2018-09-07 19:07:10 +02:00
const { Command } = require('discord.js-commando');
module.exports = class BanCommand extends Command {
constructor(client) {
super(client, {
name: 'ban',
group: 'admin',
memberName: 'ban',
description: 'ban the mentionned user',
guildOnly: true,
2018-09-07 23:57:57 +02:00
clientPermissions: ['BAN_MEMBERS'],
2018-09-07 19:07:10 +02:00
userPermissions: ['BAN_MEMBERS'],
args: [
{
key: 'member',
prompt: 'Wich member would you like to ban?',
type: 'member',
2018-10-12 10:50:54 +02:00
},
{
key: 'reasons',
prompt: 'What is the reasons of the kick',
type: 'string',
default: ''
}
2018-09-07 19:07:10 +02:00
]
});
}
2018-10-12 10:50:54 +02:00
async run(message, { member, reasons }) {
if(!reasons)
reasons = 'Nothing have been specified'
2018-09-28 16:16:35 +02:00
if(member.id === message.author.id)
return message.say("Why would you ban yourself ?")
await member.send(`https://youtu.be/55-mHgUjZfY\nYou have been banned for the following reasons: "${reasons}"`);
2018-10-17 19:11:46 +02:00
member.ban(`Banned by : ${message.author.username} for the following reasons : ${reasons}`)
2018-10-12 10:50:54 +02:00
.then(() => message.reply(`${member.user.username} was succesfully banned with the following reasons "${reasons}".`));
2018-09-25 20:09:42 +02:00
};
2018-09-07 19:07:10 +02:00
};