mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-03 23:36:43 +02:00
37 lines
946 B
JavaScript
37 lines
946 B
JavaScript
const Command = require('../../framework/Command');
|
|
const { removeFromArray } = require('../../util/Util');
|
|
const types = ['user', 'guild'];
|
|
|
|
module.exports = class UnblacklistCommand extends Command {
|
|
constructor(client) {
|
|
super(client, {
|
|
name: 'unblacklist',
|
|
aliases: ['whitelist'],
|
|
group: 'util',
|
|
description: 'Unblacklists a user or server.',
|
|
details: 'Only the bot owner(s) may use this command.',
|
|
ownerOnly: true,
|
|
guarded: true,
|
|
args: [
|
|
{
|
|
key: 'type',
|
|
type: 'string',
|
|
oneOf: types,
|
|
parse: type => type.toLowerCase()
|
|
},
|
|
{
|
|
key: 'target',
|
|
type: 'string'
|
|
}
|
|
]
|
|
});
|
|
}
|
|
|
|
run(msg, { type, target }) {
|
|
if (!this.client.blacklist[type].includes(target)) return msg.say(`🔨 \`${target}\` is not blacklisted.`);
|
|
removeFromArray(this.client.blacklist[type], target);
|
|
this.client.exportBlacklist();
|
|
return msg.say(`🔨 Unblacklisted ${type} \`${target}\`.`);
|
|
}
|
|
};
|