From 2d1088171ce6ed48c8e2c9224f87327d99e7f54f Mon Sep 17 00:00:00 2001 From: Daniel Odendahl Jr Date: Sat, 26 Aug 2017 02:14:20 +0000 Subject: [PATCH] One last change --- commands/moderation/lockdown.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/commands/moderation/lockdown.js b/commands/moderation/lockdown.js index 331b0da0..2089760d 100644 --- a/commands/moderation/lockdown.js +++ b/commands/moderation/lockdown.js @@ -37,12 +37,16 @@ module.exports = class LockdownCommand extends Command { } ] }); + + this.channels = new Set(); } async run(msg, args) { // eslint-disable-line consistent-return const { action, time } = args; if (action === 'start') { + if (this.channels.has(msg.channel.id)) return msg.say('This channel is already locked down.'); await msg.channel.overwritePermissions(msg.guild.defaultRole, { SEND_MESSAGES: false }); + this.channels.add(msg.channel.id); await msg.say(stripIndents` Lockdown started, users without overwrites can no longer post messages. ${time ? `Please wait ${time / 60000} minutes.` : 'Please use `lockdown stop` to end the lockdown.'} @@ -50,10 +54,13 @@ module.exports = class LockdownCommand extends Command { if (!time) return null; await wait(time); await msg.channel.overwritePermissions(msg.guild.defaultRole, { SEND_MESSAGES: null }); + this.channels.delete(msg.channel.id); return msg.say('Lockdown ended, all users can now post messages.'); } if (action === 'stop') { + if (!this.channels.has(msg.channel.id)) return msg.say('This channel is not locked down.'); await msg.channel.overwritePermissions(msg.guild.defaultRole, { SEND_MESSAGES: null }); + this.channels.delete(msg.channel.id); return msg.say('Lockdown ended, all users can now post messages.'); } }