# CooldownOptions

`interface` in `core` · v0.14.0

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

Options for [`Cooldown`](/docs/packages/core/0.14.0/functions/cooldown). `per` sets the bucket that 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?: CooldownScope
```

The bucket the cooldown window applies to. 'user' scopes by user ID (falls back to global when the source doesn't have a user id). 'guild' scopes by guild ID (falls back to global when the source doesn't have a guild), and 'channel' scopes by channel ID (falls back to global when the source doesn't have a channel).
