Skip to content
Interfacecorev0.10.0

GateContextBase

The transport-agnostic gate context, the scalar identity of the acting user resolvable from any transport's payload. Every field except core is nullable, since an event or DM may carry no guild or member. Each transport extends it with its own arm. For example, the gateway adds the djs user/guild/member objects and the live interaction or event payload.

interface GateContextBase

appPermissions

The bot's permissions in the invoked channel, the wire app_permissions value. Null on gateway events.

readonly appPermissions: bigint | null

channelId

The channel id, or null when the source carries none.

readonly channelId: string | null

core

Gates read the config and the rate limiter through it.

readonly core: CoreBase

declaredRoute

The handler's own route, as kind:route (slash:daily, button:confirm). A handler registered on several reports the one this dispatch matched. Null when the handler declares none, which covers a plain event handler, the unhandled default, and a gate run outside a handler.

readonly declaredRoute: string | null

dispatch

The bag for this dispatch, the same instance the handler and its middleware hold. Every middleware runs before the first gate. A gate therefore reads what a middleware wrote.

readonly dispatch: DispatchContext

guildId

The guild id, or null outside a guild.

readonly guildId: string | null

memberPermissions

The member's permission bits, or null outside a guild. On an interaction these are the channel-scoped permissions the payload contains, and on a gateway event they're the member's guild-level ones.

readonly memberPermissions: bigint | null

memberRoleIds

The member's role ids without the everyone role, the shape a raw interaction payload contains. Empty outside a guild or when the source contains none.

readonly memberRoleIds: readonly string[]

userId

The acting user's id, or null on an event that carries none.

readonly userId: string | null