Skip to content
Functioncorev0.12.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?

Replace a refusal with a Notice class as notInGuild or missingRole.