# buildKey

`function` in `core` · v0.12.0

<https://seedcord.org/docs/packages/core/0.12.0/functions/build-key>

Builds a rate-limit key from a prefix and scope parts, joined with `:`. A null or undefined part
becomes `'global'`. A key built from a DM's guild id reads `<prefix>:global` for every DM caller.

```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'`. A key built from a DM's guild id reads `<prefix>:global` for every DM caller.

Parameters.

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

Returns `string`.
