|
|
|
@ -13,7 +13,7 @@ function check(user, commandName, commands) {
|
|
|
|
|
|
|
|
|
|
const date = new Date();
|
|
|
|
|
if (ratelimit[userID][commandName]) {
|
|
|
|
|
if (ratelimit[userID][commandName].cooldown) {
|
|
|
|
|
if (ratelimit[userID][commandName].cooldown && ratelimit[userID][commandName].limit === commands.ratelimit) {
|
|
|
|
|
if (date > ratelimit[userID][commandName].cooldown) {
|
|
|
|
|
ratelimit[userID][commandName].limit = 0;
|
|
|
|
|
ratelimit[userID][commandName].cooldown = undefined;
|
|
|
|
@ -32,12 +32,9 @@ function check(user, commandName, commands) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (commands.ratelimit) {
|
|
|
|
|
ratelimit[userID][commandName] = { limit: ratelimit[userID][commandName] ? ratelimit[userID][commandName].limit + 1 : 1 };
|
|
|
|
|
if (commands.ratelimit === ratelimit[userID][commandName].limit) {
|
|
|
|
|
date.setSeconds(date.getSeconds() + commands.cooldown);
|
|
|
|
|
|
|
|
|
|
ratelimit[userID][commandName] = { limit: ratelimit[userID][commandName].limit, cooldown: date };
|
|
|
|
|
}
|
|
|
|
|
ratelimit[userID][commandName] = { limit: ratelimit[userID][commandName] ? ratelimit[userID][commandName].limit + 1 : 1, cooldown: date };
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
}
|