2018-12-30 01:20:24 +01:00
|
|
|
const { Command } = require('discord-akairo');
|
2018-12-25 19:17:07 +01:00
|
|
|
|
2018-12-30 01:20:24 +01:00
|
|
|
class KickCommand extends Command {
|
2019-01-02 08:09:45 +01:00
|
|
|
constructor() {
|
|
|
|
super('kick', {
|
|
|
|
aliases: ['kick'],
|
|
|
|
category: 'admin',
|
|
|
|
args: [
|
|
|
|
{
|
|
|
|
id: 'member',
|
2019-06-23 03:41:59 +02:00
|
|
|
type: 'member',
|
|
|
|
prompt: {
|
2019-11-15 21:39:53 +01:00
|
|
|
start: 'which member do you want to ban?',
|
2019-06-23 03:41:59 +02:00
|
|
|
}
|
2019-01-02 08:09:45 +01:00
|
|
|
},
|
|
|
|
{
|
|
|
|
id: 'reasons',
|
2019-01-14 11:41:15 +01:00
|
|
|
type: 'string',
|
2019-06-23 03:41:59 +02:00
|
|
|
prompt: {
|
|
|
|
start: 'For what reasons?',
|
|
|
|
optional: true
|
|
|
|
},
|
2019-01-14 11:41:15 +01:00
|
|
|
match: 'rest'
|
2019-01-02 08:09:45 +01:00
|
|
|
}
|
|
|
|
],
|
2019-11-09 12:04:01 +01:00
|
|
|
clientPermissions: ['KICK_MEMBERS', 'SEND_MESSAGES'],
|
2019-01-02 08:09:45 +01:00
|
|
|
userPermissions: ['KICK_MEMBERS'],
|
2020-03-19 23:24:31 +01:00
|
|
|
channel: 'guild',
|
2019-01-02 08:09:45 +01:00
|
|
|
description: {
|
|
|
|
content: 'Kick user',
|
2019-11-09 12:04:01 +01:00
|
|
|
usage: '[@user] [reason]',
|
2019-01-02 08:09:45 +01:00
|
|
|
examples: ['@user big dumb dumb']
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
2018-09-07 19:07:10 +02:00
|
|
|
|
2019-01-02 08:09:45 +01:00
|
|
|
async exec(message, args) {
|
|
|
|
let member = args.member;
|
|
|
|
let reasons = args.reasons;
|
2018-12-30 01:20:24 +01:00
|
|
|
|
2019-01-02 08:09:45 +01:00
|
|
|
if(member === this.client.user)
|
2020-03-19 17:02:57 +01:00
|
|
|
return message.channel.send('Cant kick me fool');
|
2019-01-02 08:09:45 +01:00
|
|
|
if(member.id === message.author.id)
|
2020-03-19 17:02:57 +01:00
|
|
|
return message.channel.send('Why would you kick yourself ?');
|
2019-01-02 08:09:45 +01:00
|
|
|
if(!reasons)
|
|
|
|
reasons = 'Nothing have been specified.';
|
2018-12-30 01:20:24 +01:00
|
|
|
|
2019-03-12 20:27:51 +01:00
|
|
|
await member.send(`You have been kicked from **${message.guild.name}** for the following reasons: "**${reasons}**"`)
|
|
|
|
.catch(() => console.log('could not send message to the concerned user'));
|
|
|
|
|
2019-08-30 22:11:10 +02:00
|
|
|
return member.kick({reason: `Kicked by : ${message.author.username} for the following reasons: ${reasons}`})
|
2019-01-02 08:09:45 +01:00
|
|
|
.then(() => message.reply(`${member.user.username} was succesfully kicked with the following reasons "${reasons}".`))
|
|
|
|
.catch(err => console.error(err));
|
|
|
|
}
|
2018-12-30 01:20:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
module.exports = KickCommand;
|