forked from Galactic/galactic-bot
89 lines
2.8 KiB
JavaScript
89 lines
2.8 KiB
JavaScript
|
const { Command } = require('../../../../interfaces/');
|
||
|
const { Warn } = require('../../../../moderation/infractions/');
|
||
|
|
||
|
class WarnCommand extends Command {
|
||
|
|
||
|
constructor(client) {
|
||
|
|
||
|
super(client, {
|
||
|
name: 'warn',
|
||
|
module: 'moderation',
|
||
|
usage: "<member..> [reason]",
|
||
|
memberPermissions: ['KICK_MEMBERS'],
|
||
|
examples: [
|
||
|
"@nolan#2887 @Navy.gif#1998 being rude"
|
||
|
],
|
||
|
keepQuotes: true,
|
||
|
arguments: [
|
||
|
{
|
||
|
name: 'points',
|
||
|
aliases: ['point', 'modpoints', 'modpoint', 'pts', 'pt'],
|
||
|
type: 'INTEGER',
|
||
|
types: ['VERBAL', 'FLAG'],
|
||
|
usage: '<amount>',
|
||
|
default: (guild) => {
|
||
|
return guild._settings.moderationPoints.points.WARN;
|
||
|
},
|
||
|
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.WARN;
|
||
|
}
|
||
|
},
|
||
|
{
|
||
|
name: 'force',
|
||
|
type: 'BOOLEAN',
|
||
|
types: ['FLAG'],
|
||
|
default: true
|
||
|
},
|
||
|
{
|
||
|
name: 'prune',
|
||
|
aliases: ['purge'],
|
||
|
type: 'INTEGER',
|
||
|
types: ['FLAG'],
|
||
|
usage: '<amount>',
|
||
|
default: 50,
|
||
|
min: 2, max: 50,
|
||
|
ignoreInvalid: true
|
||
|
},
|
||
|
{
|
||
|
name: 'silent',
|
||
|
type: 'BOOLEAN',
|
||
|
types: ['FLAG'],
|
||
|
default: true
|
||
|
}
|
||
|
],
|
||
|
guildOnly: true,
|
||
|
showUsage: true
|
||
|
});
|
||
|
}
|
||
|
|
||
|
async execute(message, { params }) {
|
||
|
|
||
|
const { parsed, parameters } = await this.client.resolver.infinite(params, [
|
||
|
this.client.resolver.resolveMember.bind(this.client.resolver)
|
||
|
], true, message.guild);
|
||
|
|
||
|
if(parsed.length === 0) return message.respond(message.format('C_WARN_MISSINGMEMBERS'), {
|
||
|
emoji: 'failure'
|
||
|
});
|
||
|
|
||
|
return this.client.moderationManager
|
||
|
.handleInfraction(Warn, message, {
|
||
|
targets: parsed,
|
||
|
reason: parameters.join(' ')
|
||
|
});
|
||
|
|
||
|
}
|
||
|
|
||
|
}
|
||
|
|
||
|
module.exports = WarnCommand;
|