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

53 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"
],
arguments: [
{
name: 'silent',
type: 'BOOLEAN',
types: ['FLAG'],
default: true
}
],
guildOnly: true,
showUsage: true,
throttling: {
usages: 2,
duration: 5
}
});
}
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_NOTE_MISSINGMEMBERS'), {
emoji: 'failure'
});
return this.client.moderationManager
.handleInfraction(Note, message, {
targets: parsed,
reason: parameters.join(' ')
});
}
}
module.exports = NoteCommand;