# Cooldown

`function` in `seedcord` · v0.14.0

<https://docs.seedcord.org/packages/seedcord/0.14.0/functions/cooldown>

Allows `limit` uses per window, scoped by `per`. A number `duration` is **seconds**, a string is a duration like `30m` or `24h`. An unparseable string throws a **SeedcordTypeError** at construction. The slot is charged in commit, only after the whole gate set passes, so a later refusal never burns the cooldown. Each call gets its own bucket, so two handlers never share a window. Reword the refusal with [`message`](/packages/seedcord/0.14.0/interfaces/cooldown-options#message) or replace it with [`notice`](/packages/seedcord/0.14.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**, a string is a duration like `30m` or `24h`. An unparseable string throws a **SeedcordTypeError** at construction. The slot is charged in commit, only after the whole gate set passes, so a later refusal never burns the cooldown. Each call gets its own bucket, so two handlers never share a window. Reword the refusal with [`message`](/packages/seedcord/0.14.0/interfaces/cooldown-options#message) or replace it with [`notice`](/packages/seedcord/0.14.0/interfaces/cooldown-options#notice).

Parameters.

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

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