Cooldown

annotation class Cooldown(val cooldown: Long = 0, val unit: ChronoUnit = ChronoUnit.MILLIS, val scope: RateLimitScope = RateLimitScope.USER, val deleteOnRefill: Boolean = true)(source)

Add a simple rate limit-based cooldown of this text / application command and components.

Note: This won't apply if you are a bot owner.

Text commands note: This applies to the command itself, not only this variation, in other words, this applies to all commands with the same path.

Persistent bucket storage

Since this annotation stores buckets in-memory by default, the rate limits applied will be lost upon restart, however you can implement AnnotatedRateLimiterFactory in a service, and then uses your own ProxyManager which stores your buckets in persistent storage, alongside RateLimiter.createDefaultProxied.

Cooldown cancellation

The cooldown can be cancelled inside the command with CancellableRateLimit.cancelRateLimit on your event.

See also

@RateLimit

In-command equivalent

Code-declared equivalent

Properties

Link copied to clipboard
val cooldown: Long = 0

Cooldown time in the specified unit before the command can be used again in the scope specified by scope.

Link copied to clipboard

Whether the cooldown message should be deleted after the cooldown has expired.

Link copied to clipboard

Scope of the cooldown, see RateLimitScope values.

Link copied to clipboard

The time unit of the cooldown