From 867b13dd079044edb700092463e3485964f02c54 Mon Sep 17 00:00:00 2001 From: bdistin Date: Sat, 10 Jun 2017 18:28:34 -0500 Subject: [PATCH] Solve weird edge case that shouldn't exist in the first place, but meh (#264) --- inhibitors/commandCooldown.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/inhibitors/commandCooldown.js b/inhibitors/commandCooldown.js index f4ce6107..06e3be88 100644 --- a/inhibitors/commandCooldown.js +++ b/inhibitors/commandCooldown.js @@ -13,5 +13,11 @@ exports.run = (client, msg, cmd) => { if (!instance) return false; const remaining = ((cmd.conf.cooldown * 1000) - (Date.now() - instance)) / 1000; + + if (remaining < 0) { + cmd.cooldown.delete(msg.author.id); + return false; + } + return `You have just used this command. You can use this command again in ${Math.ceil(remaining)} seconds.`; };