# GuildPermissionsContext

`interface` in `core` · v0.14.0

<https://seedcord.org/docs/packages/core/0.14.0/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. It's `0n` in a guild the bot isn't in. It's null
when the guild is cached but the bot's member isn't.

### channelId

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

The channel id, or null when there isn't one.

### core

```ts
readonly core: CoreBase
```

Gates read the config and the rate limiter through it.

### dispatch

```ts
readonly dispatch: DispatchContext
```

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

### guildId

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

The guild id, or null outside a guild.

### guildLocale

```ts
readonly guildLocale: Locale | null
```

The guild's preferred language, 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, 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 event doesn't carry the member's roles.

### userId

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

The id of the user who triggered it, or null on an event without a user.

### userLocale

```ts
readonly userLocale: Locale | null
```

The language that the user picked in Discord, or null on a gateway event because a discord.js `User` doesn't have one.
