Skip to content
Functiongatewayv0.11.0

checkPermissions

Checks a Role or a GuildMember against the base permission set from roles, or against a channel's set when in is given. Refuses when a permission in scope is missing, or with inverse when one is present.

Throws:

  • A Notice when the check refuses. It lists the missing or present permissions.

checkPermissions(
    { for: target, in: channel, scope, inverse, notice },
    input: CheckPermissionOptions
): void
import { PermissionFlagsBits } from 'discord.js';
import { checkPermissions } from '@seedcord/gateway';

checkPermissions({ for: member, scope: [PermissionFlagsBits.KickMembers] });
checkPermissions({ for: role, in: channel, scope: [PermissionFlagsBits.SendMessages] });
// refuse when the member holds Administrator, with your own Notice class
checkPermissions({ for: member, scope: [PermissionFlagsBits.Administrator], inverse: true, notice: TooPowerful });

{ for: target, in: channel, scope, inverse, notice }

{ for: target, in: channel, scope, inverse, notice }