Skip to content
Functioncorev0.10.0

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.

See also:the @Gated decorator from your transport package

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

roleId

roleId: string

The role snowflake the caller must hold.

options?

Override each refusal, the outside-guild one with notInGuild and the missing-role one with missingRole.