[x] My PR fixes a bug, error, or other issue with the library's codebase.
[x] My PR is for the command module of the JDA-Utilities library.
[ ] My PR creates a new module for the JDA-Utilities library: ______.
Description
This PR adds 2 fixes to the cooldown handling:
Cooldowns are now properly rounded up
Up until now, CommandClient#getRemainingCooldown() returns the rounded down amount of seconds remaining, which results in cooldowns effectively being (almost) 1 second shorter than they should be:
If 1 second cooldown is set, then at the next check (lets assume 990ms cooldown left), getRemainingCooldown() would return 0, which in turn allows the command to be executed again.
By fetching the amount of ms remaining and rounding that up to the next second, this PR attemts to fix that issue.
Allows for disabling of cooldown error message
Now it is possible to override Command#getCooldownError() and return null in order to disable cooldown error messages to be sent
Pull Request
Pull Request Checklist
Please follow the following steps before opening this PR.
PRs that do not complete the checklist will be subject to denial for missing information.
Pull Request Information
Check and fill in the blanks for all that apply:
command
module of the JDA-Utilities library.______
.Description
This PR adds 2 fixes to the cooldown handling:
Cooldowns are now properly rounded up
Up until now,
CommandClient#getRemainingCooldown()
returns the rounded down amount of seconds remaining, which results in cooldowns effectively being (almost) 1 second shorter than they should be: If 1 second cooldown is set, then at the next check (lets assume 990ms cooldown left),getRemainingCooldown()
would return 0, which in turn allows the command to be executed again.By fetching the amount of ms remaining and rounding that up to the next second, this PR attemts to fix that issue.
Allows for disabling of cooldown error message
Now it is possible to override
Command#getCooldownError()
and returnnull
in order to disable cooldown error messages to be sent