# CooldownOptions

`interface` in `core` · v0.12.0

<https://seedcord.org/docs/packages/core/0.12.0/interfaces/cooldown-options>

Options for [`Cooldown`](/docs/packages/core/0.12.0/functions/cooldown). `per` sets the bucket the window applies to and `limit` the uses allowed per
window. `notice` replaces the refusal.

```ts
interface CooldownOptions
```

## Examples

```ts
// one use per channel, refusing with your own Notice class
class SlowDown extends Notice {
    public constructor(resetAt: EpochMs) {
        super(`Slow down. Try again <t:${toEpochSeconds(resetAt)}:R>.`);
    }
}

Cooldown('10s', { per: 'channel', notice: SlowDown });
```

```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.

### notice

```ts
notice?: NoticeConstructor<[resetAt: EpochMs]>
```

Your Notice class, constructed with the epoch ms the key frees up and thrown in place of the default refusal.

### 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).
