Fixed cooldown

This commit is contained in:
Emily 2020-03-26 15:57:53 +11:00
parent 566c049b10
commit 3589373ce9
2 changed files with 8 additions and 7 deletions

View file

@ -1,4 +1,4 @@
const commandRanRecently = new Set(); const cooldown = new Set();
module.exports = async (client, message) => { module.exports = async (client, message) => {
if (message.author.bot) return; if (message.author.bot) return;
@ -151,11 +151,11 @@ module.exports = async (client, message) => {
if (!cmd) return; if (!cmd) return;
if (commandRanRecently.has(message.author.id)) { if (cooldown.has(message.author.id)) {
return message.channel.send( return message.channel.send(
`⏱️ You are being ratelimited. Please try again in 2 seconds.` `⏱️ 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')) { if (message.guild && !perms.has('SEND_MESSAGES')) {
@ -222,10 +222,11 @@ module.exports = async (client, message) => {
message.flags.push(args.shift().slice(1)); message.flags.push(args.shift().slice(1));
}; };
commandRanRecently.add(message.author.id); cooldown.add(message.author.id);
setTimeout(() => { setTimeout(() => {
commandRanRecently.delete(message.author.id); cooldown.delete(message.author.id);
}, {timeout: 2000}); }, 2000);
client.logger.cmd(`${client.config.permLevels.find(l => l.level === level).name} ${message.author.username} (${message.author.id}) ran command ${cmd.help.name}`); client.logger.cmd(`${client.config.permLevels.find(l => l.level === level).name} ${message.author.username} (${message.author.id}) ran command ${cmd.help.name}`);

View file

@ -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" "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"
} }