From 7c6921b8446fc17af356864268836095e11ed006 Mon Sep 17 00:00:00 2001 From: mudkipscience Date: Tue, 3 Mar 2020 02:01:40 +0000 Subject: [PATCH] No longer complains about ratelimits randomly --- src/events/message.js | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/events/message.js b/src/events/message.js index f63b531..7243c87 100644 --- a/src/events/message.js +++ b/src/events/message.js @@ -130,13 +130,6 @@ module.exports = async (client, message) => { }); }; }; - - if (commandRanRecently.has(message.author.id)) { - return message.channel.send( - `<:wait:467115775849922570> You are being ratelimited. Please try again in 2 seconds.` - ) - .then(m => m.delete(2000)); - }; const prefixMention = new RegExp(`^<@!?${client.user.id}>( |)$`); @@ -151,6 +144,13 @@ module.exports = async (client, message) => { const cmd = client.commands.get(command) || client.commands.get(client.aliases.get(command)); if (!cmd) return; + + if (commandRanRecently.has(message.author.id)) { + return message.channel.send( + `<:wait:467115775849922570> You are being ratelimited. Please try again in 2 seconds.` + ) + .then(m => m.delete(2000)); + }; if (!perms.has('SEND_MESSAGES')) { return message.author.send(`<:error:466995152976871434> I don't have permission to speak in **#${message.channel.name}**, Please ask a moderator to give me the send messages permission!`); @@ -224,4 +224,4 @@ module.exports = async (client, message) => { client.logger.cmd(`${client.config.permLevels.find(l => l.level === level).name} ${message.author.username} (${message.author.id}) ran command ${cmd.help.name}`); cmd.run(client, message, args, level); -}; \ No newline at end of file +};