From 3589373ce922774e701aa1427be7a0a1725ccc9f Mon Sep 17 00:00:00 2001 From: mudkipscience Date: Thu, 26 Mar 2020 15:57:53 +1100 Subject: [PATCH] Fixed cooldown --- src/events/message.js | 13 +++++++------ version.json | 2 +- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/events/message.js b/src/events/message.js index dc5611e..fab2583 100644 --- a/src/events/message.js +++ b/src/events/message.js @@ -1,4 +1,4 @@ -const commandRanRecently = new Set(); +const cooldown = new Set(); module.exports = async (client, message) => { if (message.author.bot) return; @@ -151,11 +151,11 @@ module.exports = async (client, message) => { if (!cmd) return; - if (commandRanRecently.has(message.author.id)) { + if (cooldown.has(message.author.id)) { return message.channel.send( `⏱️ You are being ratelimited. Please try again in 2 seconds.` ) - .then(m => m.delete(2000)); + .then(m => m.delete(5000)); }; if (message.guild && !perms.has('SEND_MESSAGES')) { @@ -222,10 +222,11 @@ module.exports = async (client, message) => { message.flags.push(args.shift().slice(1)); }; - commandRanRecently.add(message.author.id); + cooldown.add(message.author.id); + setTimeout(() => { - commandRanRecently.delete(message.author.id); - }, {timeout: 2000}); + cooldown.delete(message.author.id); + }, 2000); client.logger.cmd(`${client.config.permLevels.find(l => l.level === level).name} ${message.author.username} (${message.author.id}) ran command ${cmd.help.name}`); diff --git a/version.json b/version.json index f89b995..92c7223 100644 --- a/version.json +++ b/version.json @@ -1,4 +1,4 @@ { - "number": "1.2.0", + "number": "1.2.1", "changelog": "**1.2.0 CHANGELOG:**\n> • Added action commands! (`cuddle`, `feed`, `hug`, `kiss`, `pat`, `poke`, `slap`, `smug`, `tickle`)\n> • Added `fact`\n> • Added `catfact`\n> • Added `dogfact`\n> • Added `yoda`\n> • Added `dice`\n> • Added `spoilerise`\n> • Added `zalgo`\n> • Added `dog`\n> • Added `cat`\n> • Added `lizard`\n> • Added `neko`\n> • Added `nekogif`\n> • Added `kemonomimi`\n> • Added `foxgirl`\n> • Added `identity`\n> • Added `pronouns`\n> • Added `sexuality`\n> • Added `ship`\n> • Renamed `flip to `coinflip` (flip remains as an alias)\n> • Renamed `math` to `calculate` (math is an alias)\n> • @Woomy is now a prefix\n> • Added the `inspire` alias to `inspirobot`\n> • Help now displays the amount of commands in each category\n> • Bots now get a badge in `userinfo`\n> • `roleinfo` now displays what permissions a role has\n> • small changes to `weather`\n> • Woomy now has clear logging of issues that prevent her from starting\n> • request npm module has been swapped out for node-fetch\n**NOTES:**\n> Thank you to Terryiscool160 for creating multiple commands used in this update" }