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

No way to calculate amount of time until the next drip? #88

Open
KevinNovak opened this issue Jan 8, 2022 · 0 comments
Open

No way to calculate amount of time until the next drip? #88

KevinNovak opened this issue Jan 8, 2022 · 0 comments

Comments

@KevinNovak
Copy link

KevinNovak commented Jan 8, 2022

I am using this package to create cooldowns for certain commands that users run, and I want to be able to tell the user the amount of time they have to wait until they can run the command again.

I can't seem to find any way that this is possible with the current code.

We can get:

  • The time of the last drip with myLimiter.tokenBucket.lastDrip
  • We can then calculate the next drip time based on the last drip time + the interval length

But there does not seem to be a way to tell what the current time within an interval is. Therefore I cannot calculate how much time is left before the next drip.

EDIT: It seems like this could be solved by giving us access to the internal clock, specifically getMilliseconds(). Additionally, maybe we could have a method to getTimeToNextDrip() or getTimeToNextInterval()?

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

No branches or pull requests

1 participant