Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(cooldowns): Subtract time difference correctly #7

Merged
merged 1 commit into from May 12, 2021
Merged

fix(cooldowns): Subtract time difference correctly #7

merged 1 commit into from May 12, 2021

Conversation

axisiscool
Copy link
Contributor

The current release of Knub subtracts cooldowns using:

Math.max(0, Date.now() - this.cooldownManager.get(key)!);

Doing it as it is now would always return 0, since the cooldown will always be greater than the current Date, hence flipping them would return the cooldown, and not 0 (unless there isn't a cooldown).

Copy link

@Vetlix Vetlix left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@axisiscool
Copy link
Contributor Author

Thank you @dexbiobot

@Dragory Dragory merged commit b947485 into Dragory:master May 12, 2021
@Dragory
Copy link
Owner

Dragory commented May 12, 2021

Good catch, thank you for the PR!

@axisiscool axisiscool deleted the pr_cooldown_fix branch May 13, 2021 01:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants