# EventGateContext

`interface` in `seedcord` · v0.13.0

<https://docs.seedcord.org/packages/seedcord/0.13.0/interfaces/event-gate-context>

The event arm. `Names` is the event(s) the gate supports, inferred from the `ctx` annotation, so a gate that reads one event's `payload` is rejected on a handler for a different event. The default supports every event.

```ts
interface EventGateContext<
    Names extends ValidNonInteractionKeys = ValidNonInteractionKeys
> extends GateContextBase
```

## Examples

```ts
import { Events } from 'discord.js';

// gate keyed to one event, so payload is typed to that event's args tuple
const OnMessage = defineGate('msg', (ctx: EventGateContext<Events.MessageCreate>) => {
    void ctx.payload; // [Message]
});
```

## Properties

### channelId

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

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

### core

```ts
readonly core: Core
```

The running framework, for reaching the bot, config, the rate limiter, and the bus.

### eventName

```ts
readonly eventName: Names
```

The event being handled.

### guild

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

The guild the action happened in, or null in a DM or a guildless event.

### guildId

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

The guild id, or null outside a guild.

### kind

```ts
readonly kind: 'event'
```

Marks the event arm, narrow on it before reading `payload`.

### member

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

The acting member, or null outside a guild or when uncached.

### payload

```ts
readonly payload: ClientEvents[Names]
```

The event's arguments, typed to that event's args tuple.

### user

```ts
readonly user: User | null
```

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