# RequireRole

`function` in `seedcord` · v0.13.0

<https://docs.seedcord.org/packages/seedcord/0.13.0/functions/require-role>

Requires the caller to have `roleId`, read from the member's role cache. Refuses outside a guild first, then when the role is missing.

Interaction-only and excludes ModalSubmit.

```ts
RequireRole(
    roleId: string,
    options?: RequireRoleOptions
): Gate<InteractionGateContext<NonModalInteraction>, "RequireRole">
```

Requires the caller to have `roleId`, read from the member's role cache. Refuses outside a guild first, then when the role is missing.

Interaction-only and excludes ModalSubmit.

Parameters.

- `roleId` `string` — The role snowflake the caller must hold, read from the member's role cache.
- `options?` `RequireRoleOptions` — Override each refusal, the outside-guild one with `notInGuild` and the missing-role one with `missingRole`.

Returns `Gate<InteractionGateContext<NonModalInteraction>, 'RequireRole'>`.
