# Cooldown

`function` in `core` · v0.12.0

<https://seedcord.org/docs/packages/core/0.12.0/functions/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`](/docs/packages/core/0.12.0/interfaces/cooldown-options#notice).

```ts
Cooldown(
    duration: number | ValidDuration,
    options?: CooldownOptions
): EffectGate<GateContextBase, "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`](/docs/packages/core/0.12.0/interfaces/cooldown-options#notice).

Parameters.

- `duration` `number | ValidDuration` — A number is seconds, and a string is a duration like `30m` or `24h`.
- `options?` `CooldownOptions` — Sets the scope with `per`, the uses per window with `limit`, and the refusal with `notice`.

Returns `EffectGate<GateContextBase, 'Cooldown'>`.
