From 242d11b49ef2a4cbef5ea5bfc1f7738eb5bdf3d1 Mon Sep 17 00:00:00 2001 From: Dragon Fire Date: Sat, 13 Feb 2021 16:45:00 -0500 Subject: [PATCH] Fix --- commands/util/blacklist.js | 1 + structures/Client.js | 8 ++++---- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/commands/util/blacklist.js b/commands/util/blacklist.js index 8042889d..05bde961 100644 --- a/commands/util/blacklist.js +++ b/commands/util/blacklist.js @@ -30,6 +30,7 @@ module.exports = class BlacklistCommand extends Command { } run(msg, { type, target }) { + if (this.client.blacklist[type].includes(target)) return msg.say(`🔨 \`${target}\` is already blacklisted.`); this.client.blacklist[type].push(target); this.client.exportBlacklist(); return msg.say(`🔨 Blacklisted ${type} \`${target}\`.`); diff --git a/structures/Client.js b/structures/Client.js index 771a5912..3049e1a9 100644 --- a/structures/Client.js +++ b/structures/Client.js @@ -82,14 +82,14 @@ module.exports = class XiaoClient extends CommandoClient { exportBlacklist() { let text = '{\n "guild": [\n '; for (const id of this.blacklist.guild) { - text += `"${id}",`; + text += `"${id}",\n`; } - text = text.slice(0, -1); + text = text.slice(0, -2); text += '\n ],\n "user": [\n '; for (const id of this.blacklist.user) { - text += `"${id}",`; + text += `"${id}",\n`; } - text = text.slice(0, -1); + text = text.slice(0, -2); text += '\n ]\n}\n'; const buf = Buffer.from(text); fs.writeFileSync(path.join(__dirname, '..', 'blacklist.json'), buf, { encoding: 'utf8' });