Skip to content

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

@KevinNovak

Description

@KevinNovak

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()?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions