2018-09-07 19:07:10 +02:00
|
|
|
const { Command } = require('discord.js-commando');
|
|
|
|
module.exports = class KickCommand extends Command {
|
|
|
|
constructor(client) {
|
|
|
|
super(client, {
|
|
|
|
name: 'kick',
|
|
|
|
group: 'admin',
|
|
|
|
memberName: 'kick',
|
|
|
|
description: 'Kick the mentionned user',
|
|
|
|
guildOnly: true,
|
2018-09-07 23:57:57 +02:00
|
|
|
clientPermissions: ['KICK_MEMBERS'],
|
2018-09-07 19:07:10 +02:00
|
|
|
userPermissions: ['KICK_MEMBERS'],
|
|
|
|
args: [
|
|
|
|
{
|
|
|
|
key: 'member',
|
|
|
|
prompt: 'Wich member would you like to kick?',
|
|
|
|
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 }) {
|
2018-12-23 05:46:06 +01:00
|
|
|
if(member == this.client)
|
|
|
|
message.say('Cant kick me fool')
|
2018-10-12 10:56:30 +02:00
|
|
|
if(!reasons)
|
2018-10-17 19:11:46 +02:00
|
|
|
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 kick yourself ?")
|
2018-12-23 05:41:50 +01:00
|
|
|
await member.send(`You have been kicked for the following reasons: "${reasons}"`)
|
2018-12-23 05:46:06 +01:00
|
|
|
.error(err => console.error(`Could not dm the user, probably disabled\n${err}`))
|
2018-10-17 19:11:46 +02:00
|
|
|
member.kick(`Kicked by : ${message.author.username} for the following reasons : ${reasons}`)
|
2018-12-06 20:11:21 +01:00
|
|
|
.then(() => message.reply(`${member.user.username} was succesfully kicked with the following reasons "${reasons}".`))
|
2018-09-25 20:09:42 +02:00
|
|
|
};
|
2018-09-07 19:07:10 +02:00
|
|
|
};
|