Display the cooldown more nicely
This commit is contained in:
parent
5311aa5847
commit
2c37b3a64f
1 changed files with 6 additions and 2 deletions
|
@ -21,8 +21,12 @@ function check(user, commandName, commands) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (commands.ratelimit === ratelimit[userID][commandName].limit) {
|
if (commands.ratelimit === ratelimit[userID][commandName].limit) {
|
||||||
console.log(`\x1b[33m${userTag} (${userID})\x1b[0m is rate limited on \x1b[33m${commandName}\x1b[0m for ${Math.floor((ratelimit[userID][commandName].cooldown - date) / 1000)} seconds`);
|
const seconds = Math.floor((ratelimit[userID][commandName].cooldown - date) / 1000);
|
||||||
return `You are being rate limited. You can try again in ${Math.floor((ratelimit[userID][commandName].cooldown - date) / 1000)} seconds.`;
|
const minutes = Math.floor(seconds / 60);
|
||||||
|
const hours = Math.floor(minutes / 60);
|
||||||
|
const dateString = `${hours > 0 ? `${Math.floor(hours)} hours` : ''}${minutes > 0 ? ` ${Math.floor(minutes % 60)} minutes` : ''}${seconds > 0 ? ` ${Math.floor(seconds % 60)} seconds` : ''}`;
|
||||||
|
console.log(`\x1b[33m${userTag} (${userID})\x1b[0m is rate limited on \x1b[33m${commandName}\x1b[0m for ${dateString}.`);
|
||||||
|
return `You are being rate limited. You can try again in ${dateString}.`;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue