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

65 lines
1.7 KiB
JavaScript

const { Command } = require('../../../../interfaces/');
const { Unban } = require('../../../../moderation/infractions/');
class UnbanCommand extends Command {
constructor(client) {
super(client, {
name: 'unban',
module: 'moderation',
usage: "<member..> [reason]",
clientPermissions: ['BAN_MEMBERS'],
memberPermissions: ['BAN_MEMBERS'],
aliases: [
'untempban',
'unhardban'
],
examples: [
"@nolan#2887 @Navy.gif#1998 appealed their ban"
],
arguments: [
{
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),
this.client.resolver.resolveUser.bind(this.client.resolver)
], true, message.guild);
if(parsed.length === 0) {
return message.respond(message.format('C_UNBAN_MISSINGMEMBERS'), {
emoji: 'failure'
});
}
return this.client.moderationManager
.handleInfraction(Unban, message, {
targets: parsed,
reason: parameters.join(' ')
});
}
}
module.exports = UnbanCommand;