# CooldownOptions

`interface` in `core` · v0.1.0-next.5

<https://docs.seedcord.org/packages/core/0.1.0-next.5/interfaces/cooldown-options>

Options for [`Cooldown`](/packages/core/0.1.0-next.5/functions/cooldown). `per` sets the bucket the window applies to and `limit` the uses allowed per window. `message` rewords the refusal and `notice` replaces it, both receiving the epoch ms the key frees up so the refusal can show the retry time.

```ts
interface CooldownOptions
```

## Examples

```ts
// one use per channel, rewording the refusal with the retry time
Cooldown('10s', {
    per: 'channel',
    message: (resetAt) => `Slow down. Try again <t:${Math.round(resetAt / 1000)}:R>.`
});
```

```ts
// five uses per minute, per user
Cooldown('1m', { limit: 5 });
```

## Properties

### limit

```ts
limit: number;
```

Uses allowed inside one window before the gate refuses.

### message

```ts
message: (resetAt: EpochMs) => string;
```

Reword the refusal, keeping the standard notice card. Receives the epoch ms the key frees up, so the text can include the retry time with `<t:${Math.round(resetAt / 1000)}:R>`.

### notice

```ts
notice: (resetAt: EpochMs) => Notice;
```

Replace the refusal Notice entirely, for full control or a translated copy. Receives the epoch ms the key frees up.

### per

```ts
per: "user" | "guild" | "channel";
```

The bucket the cooldown window applies to. 'user' scopes by user ID, falls back to global when the source carries no user id. 'guild' scopes by guild ID (falls back to global if no guild), and 'channel' scopes by channel ID (falls back to global if no channel).
