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

72 lines
1.9 KiB
JavaScript
Raw Normal View History

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
2021-06-09 02:39:49 +02:00
},
{
name: 'search',
type: 'STRING',
types: ['FLAG', 'VERBAL']
}
],
guildOnly: true,
2020-07-20 00:42:21 +02:00
showUsage: true,
throttling: {
usages: 2,
duration: 5
}
});
this.client = client;
}
async execute(message, { qParams }) {
2021-06-09 02:39:49 +02:00
// 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;