Cooldown
Allows limit uses per window, scoped by per. A number duration is seconds, and a string is
a duration like 30m or 24h. The slot is charged in commit, only after the whole gate set passes,
so a later refusal never burns the cooldown.
If two requests in one process pass the check together, the commit refuses the one that goes over limit.
The key combines the handler's route with the window settings, keeping two different handlers on separate
windows. Replace the refusal with notice.
Throws:
A SeedcordTypeError when
durationis a string that doesn't parse.A SeedcordRangeError when
durationis zero or negative.
See also:the @Gated decorator from your transport package, IRateLimiter
Cooldown(
duration: number | ValidDuration,
options?: CooldownOptions
): EffectGate<GateContextBase, "Cooldown">duration
duration: number | ValidDurationA number is seconds, and a string is a duration like 30m or 24h.
options?
options?: CooldownOptionsSets the scope with per, the uses per window with limit, and the refusal with notice.