# RequirePermissions

`function` in `core` · v0.12.0

<https://seedcord.org/docs/packages/core/0.12.0/functions/require-permissions>

Requires the caller to hold every permission in `scope`. Refuses outside a guild first, then when the
member's permissions are unavailable, then when a permission is missing. The Administrator bit passes any
scope.

The default `'channel'` scope reads the effective channel set the payload carries, what Discord enforces
in the invoked channel. The `'guild'` scope reads the base set from roles and requires a
[`GuildPermissionsContext`](/docs/packages/core/0.12.0/interfaces/guild-permissions-context), so it fits a gateway handler only.

## Signature 1

```ts
RequirePermissions(
    scope: PermissionScope,
    options: RequirePermissionsOptions & { in: "guild" }
): Gate<GuildPermissionsContext, "RequirePermissions">
```

Requires the caller to hold every permission in `scope`. Refuses outside a guild first, then when the
member's permissions are unavailable, then when a permission is missing. The Administrator bit passes any
scope.

The default `'channel'` scope reads the effective channel set the payload carries, what Discord enforces
in the invoked channel. The `'guild'` scope reads the base set from roles and requires a
[`GuildPermissionsContext`](/docs/packages/core/0.12.0/interfaces/guild-permissions-context), so it fits a gateway handler only.

Parameters.

- `scope` `PermissionScope` — The permission flag bits the caller must all hold.
- `options` `RequirePermissionsOptions & { in: 'guild'; }` — Pick the scope with `in`. Replace a refusal with a Notice class as `notInGuild`, `unresolved`, or `missing`.

Returns `Gate<GuildPermissionsContext, 'RequirePermissions'>`.

## Signature 2

```ts
RequirePermissions(
    scope: PermissionScope,
    options?: RequirePermissionsOptions & { in?: "channel" }
): Gate<GateContextBase, "RequirePermissions">
```

Parameters.

- `scope` `PermissionScope`
- `options?` `RequirePermissionsOptions & { in?: 'channel'; }`

Returns `Gate<GateContextBase, 'RequirePermissions'>`.
