mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-03 23:36:43 +02:00
Add unblacklist command
This commit is contained in:
@@ -0,0 +1,39 @@
|
||||
const Command = require('../../structures/Command');
|
||||
const { list, removeFromArray } = require('../../util/Util');
|
||||
const types = ['user', 'guild'];
|
||||
|
||||
module.exports = class UnblacklistCommand extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'unblacklist',
|
||||
aliases: ['whitelist'],
|
||||
group: 'util',
|
||||
memberName: 'unblacklist',
|
||||
description: 'Unblacklists a user or server.',
|
||||
details: 'Only the bot owner(s) may use this command.',
|
||||
ownerOnly: true,
|
||||
guarded: true,
|
||||
args: [
|
||||
{
|
||||
key: 'type',
|
||||
prompt: `What type do you want to unblacklist? Either ${list(types, 'or')}.`,
|
||||
type: 'string',
|
||||
oneOf: types,
|
||||
parse: type => type.toLowerCase()
|
||||
},
|
||||
{
|
||||
key: 'target',
|
||||
prompt: 'What do you want to unblacklist? Use the ID.',
|
||||
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}\`.`);
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user