# RequireRole

`function` in `core` · v0.1.0-next.5

<https://docs.seedcord.org/packages/core/0.1.0-next.5/functions/require-role>

Requires the caller to hold `roleId`, read from the member's role ids. Refuses outside a guild first, then when the role is missing. Roles are guild-global, so there is no scope dimension.

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

Requires the caller to hold `roleId`, read from the member's role ids. Refuses outside a guild first, then when the role is missing. Roles are guild-global, so there is no scope dimension.

Parameters.

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

Returns `Gate<GateContextBase, 'RequireRole'>`.
