# InteractionGateContext

`interface` in `gateway` · v0.1.0-next.3

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

The interaction arm. It extends [`GuildPermissionsContext`](/packages/core/0.1.0-next.5/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.1.0-next.3/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

### 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.

### 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.

### user

```ts
readonly user: User
```

The invoking user, always present on an interaction.
