2020-07-04 12:23:10 +02:00
|
|
|
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,
|
2020-07-20 00:42:21 +02:00
|
|
|
showUsage: true,
|
|
|
|
throttling: {
|
|
|
|
usages: 2,
|
|
|
|
duration: 5
|
|
|
|
}
|
2020-07-04 12:23:10 +02:00
|
|
|
});
|
|
|
|
|
|
|
|
this.client = client;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2021-05-10 22:09:03 +02:00
|
|
|
async execute(message, { qParams }) {
|
2020-07-04 12:23:10 +02:00
|
|
|
|
2021-05-10 22:09:03 +02:00
|
|
|
const { parsed, parameters } = await this.client.resolver.infinite(qParams, [
|
2020-07-04 12:23:10 +02:00
|
|
|
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;
|