No longer complains about ratelimits randomly

This commit is contained in:
Emily 2020-03-03 02:01:40 +00:00 committed by GitHub
parent 0fc8b2bd66
commit 7c6921b844
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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}>( |)$`); 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)); const cmd = client.commands.get(command) || client.commands.get(client.aliases.get(command));
if (!cmd) return; 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')) { 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!`); 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}`); 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); cmd.run(client, message, args, level);
}; };