# GuildPermissionsContext

`interface` in `core` · v0.1.0-next.5

<https://docs.seedcord.org/packages/core/0.1.0-next.5/interfaces/guild-permissions-context>

The context the guild-scoped permission gates require. It adds the base permission sets computed from roles alone, which only the gateway transport can provide from its cache. The http transport's context does not define these fields.

```ts
interface GuildPermissionsContext extends GateContextBase
```

## Examples

```ts
// in:'guild' returns a Gate<GuildPermissionsContext>, which fits only a gateway handler
\@Gated(RequirePermissions([PermissionFlagsBits.BanMembers], { in: 'guild' }))
```

## 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: CoreBase
```

Gates read the config and the rate limiter through it.

### guildId

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

The guild id, or null outside a guild.

### 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, on a gateway event 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.

### userId

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

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