72 lines
1.9 KiB
JavaScript
72 lines
1.9 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
|
|
},
|
|
{
|
|
name: 'search',
|
|
type: 'STRING',
|
|
types: ['FLAG', 'VERBAL']
|
|
}
|
|
],
|
|
guildOnly: true,
|
|
showUsage: true,
|
|
throttling: {
|
|
usages: 2,
|
|
duration: 5
|
|
}
|
|
});
|
|
|
|
this.client = client;
|
|
|
|
}
|
|
|
|
async execute(message, { qParams }) {
|
|
|
|
// TODO: Implement search of banlist
|
|
|
|
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; |