galactic-bot/structure/client/components/commands/moderation/Kick.js

98 lines
2.9 KiB
JavaScript

const { Command } = require('../../../../interfaces/');
const { Kick } = require('../../../../moderation/infractions/');
class KickCommand extends Command {
constructor(client) {
super(client, {
name: 'kick',
module: 'moderation',
usage: "<member..> [reason]",
clientPermissions: ['KICK_MEMBERS'],
memberPermissions: ['KICK_MEMBERS'],
examples: [
"@nolan#2887 @Navy.gif#1998 breaking the rules"
],
arguments: [
{
name: 'points',
aliases: ['point', 'modpoints', 'modpoint', 'pts', 'pt'],
type: 'INTEGER',
types: ['VERBAL', 'FLAG'],
usage: '<amount>',
default: (guild) => {
return guild._settings.moderationPoints.points.KICK;
},
min: 0, max: 100,
ignoreInvalid: true,
required: true
},
{
name: 'expiration',
aliases: ['expire', 'expires', 'expirations'],
type: 'TIME',
types: ['FLAG'],
usage: '<time>',
default: (guild) => {
return guild._settings.moderationPoints.expirations.KICK;
}
},
{
name: 'prune',
aliases: ['purge'],
type: 'INTEGER',
types: ['FLAG'],
usage: '<amount>',
default: 50,
min: 2, max: 50,
ignoreInvalid: true
},
{
name: 'force',
type: 'BOOLEAN',
types: ['FLAG'],
default: true
},
{
name: 'silent',
type: 'BOOLEAN',
types: ['FLAG'],
default: true
}
],
guildOnly: true,
showUsage: true,
throttling: {
usages: 2,
duration: 5
}
});
this.client = client;
}
async execute(message, { qParams }) {
const { parsed, parameters } = await this.client.resolver.infinite(qParams, [
this.client.resolver.resolveMember.bind(this.client.resolver)
], true, message.guild);
if(parsed.length === 0) {
return message.respond(message.format('C_KICK_MISSINGMEMBERS'), {
emoji: 'failure'
});
}
return this.client.moderationManager
.handleInfraction(Kick, message, {
targets: parsed,
reason: parameters.join(' ')
});
}
}
module.exports = KickCommand;