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

58 lines
1.6 KiB
JavaScript
Raw Normal View History

const { Command } = require('../../../../interfaces/');
const { Unlockdown } = require('../../../../moderation/infractions/');
class UnlockdownCommand extends Command {
constructor(client) {
super(client, {
name: 'unlockdown',
module: 'moderation',
usage: "[channel..] [reason..]",
aliases: [
'unlock'
],
clientPermissions: ['MANAGE_CHANNELS'],
memberPermissions: ['MANAGE_CHANNELS'],
examples: [
"#general #off-topic raid has ended"
],
arguments: [
{
name: 'silent',
type: 'BOOLEAN',
types: ['FLAG'],
default: true
}
],
guildOnly: true,
showUsage: true,
throttling: {
usages: 2,
duration: 10
2021-06-11 03:08:31 +02:00
},
archivable: false
});
}
async execute(message, { qParams }) {
let { parsed, parameters } = await this.client.resolver.infinite(qParams, [ //eslint-disable-line prefer-const
this.client.resolver.resolveChannel.bind(this.client.resolver)
], true, message.guild, (c) => c.type === 'text');
if(parsed.length === 0) {
parsed = [ message.channel ];
}
return this.client.moderationManager
.handleInfraction(Unlockdown, message, {
targets: parsed,
reason: parameters.join(' ')
});
}
}
module.exports = UnlockdownCommand;