# buildKey

`function` in `rate-limiter` · v0.1.0-next.3

<https://docs.seedcord.org/packages/rate-limiter/0.1.0-next.3/functions/build-key>

Builds a rate-limit key from a prefix and scope parts, joined with `:`. A null or undefined part becomes `'global'`, so a missing scope (a DM's guild id) collapses into one shared bucket.

```ts
buildKey(
    prefix: string,
    parts: readonly (string | null | undefined)[]
): string
```

Builds a rate-limit key from a prefix and scope parts, joined with `:`. A null or undefined part becomes `'global'`, so a missing scope (a DM's guild id) collapses into one shared bucket.

Parameters.

- `prefix` `string` — Names the bucket family, e.g. `'cooldown'`.
- `parts` `readonly (string | null | undefined)[]` — Scope values, e.g. a user or guild id.

Returns `string`.
