# InteractionGateContext

`interface` in `gateway` · v0.2.1-next.0

<https://docs.seedcord.org/packages/gateway/0.2.1-next.0/interfaces/interaction-gate-context>

The interaction arm. It extends [`GuildPermissionsContext`](/packages/core/0.7.0/interfaces/guild-permissions-context) with the live interaction and the djs objects resolved from the gateway cache. `Repliable` is the interaction type the gate supports, inferred from the `ctx` annotation, so a gate reading button-specific fields is rejected on a slash handler. `interaction` is the reply target, so `user` is always present. Use [`NonModalInteraction`](/packages/gateway/0.2.1-next.0/types/non-modal-interaction) to exclude ModalSubmit when the gate needs a reliable caller member or channel.

```ts
interface InteractionGateContext<
    Repliable extends Repliables = Repliables
> extends GuildPermissionsContext
```

## Examples

```ts
import type { ButtonInteraction } from 'discord.js';

// a button-only gate: the Repliable generic narrows which handlers accept it
const ButtonGate = defineGate('btn', (ctx: InteractionGateContext<ButtonInteraction>) => {
    void ctx.interaction; // ButtonInteraction
});
```

## Properties

### appGuildPermissions

```ts
readonly appGuildPermissions: bigint | null
```

The bot's base permission set from the transport's cache. Null when the cached member is unavailable.

### appPermissions

```ts
readonly appPermissions: bigint | null
```

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

### channelId

```ts
readonly channelId: string | null
```

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

### core

```ts
readonly core: Core
```

The running framework, with the gateway's bot and bus.

### guild

```ts
readonly guild: Guild | null
```

The guild the interaction happened in, or null in a DM.

### guildId

```ts
readonly guildId: string | null
```

The guild id, or null outside a guild.

### interaction

```ts
readonly interaction: Repliable
```

The interaction being handled, which is the reply target.

### kind

```ts
readonly kind: 'interaction'
```

The literal `'interaction'`. Narrow on it before reading `interaction`.

### member

```ts
readonly member: GuildMember | null
```

The invoking member from the cache, or null outside a guild or when uncached.

### memberGuildPermissions

```ts
readonly memberGuildPermissions: bigint | null
```

The member's base permission set, roles only, matching djs `GuildMember.permissions`. Null when the member is unavailable.

### memberPermissions

```ts
readonly memberPermissions: bigint | null
```

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.

### memberRoleIds

```ts
readonly memberRoleIds: readonly string[]
```

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.

### routeId

```ts
readonly routeId: string | null
```

The dispatched handler as `kind:route` (`slash:daily`, `button:confirm`), or null off a route (a plain event handler, or a gate run outside a handler). `runHandlerGates` sets it from the handler's metadata. `Cooldown` uses it so its window is stable across restarts and isolates.

### user

```ts
readonly user: User
```

The invoking user, always present on an interaction.

### userId

```ts
readonly userId: string | null
```

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