From 4700e295b8549b1210678f34d62dc37bfcf35a28 Mon Sep 17 00:00:00 2001 From: Dragon Fire Date: Sat, 13 Feb 2021 17:57:00 -0500 Subject: [PATCH] Add unblacklist command --- commands/util/unblacklist.js | 39 ++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 commands/util/unblacklist.js diff --git a/commands/util/unblacklist.js b/commands/util/unblacklist.js new file mode 100644 index 00000000..a2487860 --- /dev/null +++ b/commands/util/unblacklist.js @@ -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}\`.`); + } +};