# RequireBotPermissions

`function` in `core` · v0.12.0

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

Requires the bot to hold every permission in `scope`. Refuses outside a guild first, then when a
permission is missing. The Administrator bit passes any scope.

The default `'channel'` scope reads the bot's effective channel set (wire `app_permissions`), what
Discord enforces in the invoked channel. The `'guild'` scope reads the bot's base set from roles and
requires a [`GuildPermissionsContext`](/docs/packages/core/0.12.0/interfaces/guild-permissions-context), fitting a gateway handler only. The channel scope requires an
[`AppPermissionsContext`](/docs/packages/core/0.12.0/interfaces/app-permissions-context). An event handler takes `in: 'guild'`.

## Signature 1

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

Requires the bot to hold every permission in `scope`. Refuses outside a guild first, then when a
permission is missing. The Administrator bit passes any scope.

The default `'channel'` scope reads the bot's effective channel set (wire `app_permissions`), what
Discord enforces in the invoked channel. The `'guild'` scope reads the bot's base set from roles and
requires a [`GuildPermissionsContext`](/docs/packages/core/0.12.0/interfaces/guild-permissions-context), fitting a gateway handler only. The channel scope requires an
[`AppPermissionsContext`](/docs/packages/core/0.12.0/interfaces/app-permissions-context). An event handler takes `in: 'guild'`.

Parameters.

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

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

## Signature 2

```ts
RequireBotPermissions(
    scope: PermissionScope,
    options?: RequireBotPermissionsOptions & { in?: "channel" }
): Gate<AppPermissionsContext, "RequireBotPermissions">
```

Parameters.

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

Returns `Gate<AppPermissionsContext, 'RequireBotPermissions'>`.
