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

50 lines
1.4 KiB
JavaScript

const { Command } = require('../../../../interfaces/');
const { Note } = require('../../../../moderation/infractions/');
class NoteCommand extends Command {
constructor(client) {
super(client, {
name: 'note',
module: 'moderation',
usage: "<member..> [note]",
memberPermissions: ['KICK_MEMBERS'],
examples: [
"@nolan#2887 @Navy.gif#1998 they might be spamming"
],
keepQuotes: true,
arguments: [
{
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_NOTE_MISSINGMEMBERS'), {
emoji: 'failure'
});
return this.client.moderationManager
.handleInfraction(Note, message, {
targets: parsed,
reason: parameters.join(' ')
});
}
}
module.exports = NoteCommand;