Skip to content
Functiongatewayv0.11.0

hasPermsToAssign

Validates that the bot can assign a role. Refuses when the role is at or above the bot's, when an integration manages it, or when the bot lacks Manage Roles.

Throws:

  • A Notice when the check refuses.

  • A SeedcordError when the guild's caches don't hold the bot's role or member.

hasPermsToAssign(
    { role, higher, managed, missing },
    input: HasPermsToAssignOptions
): void
import { hasPermsToAssign } from '@seedcord/gateway';

hasPermsToAssign({ role });

// with your own Notice classes
hasPermsToAssign({ role, higher: RoleTooHigh, managed: RoleIsManaged, missing: CannotManageRoles });

{ role, higher, managed, missing }

{ role, higher, managed, missing }