Skip to content

Permissions

classe · Source

Data structure that makes it easy to interact with a permission bitfield. All GuildMembers have a set of permissions in their guild, and each channel in the guild may also have PermissionOverwrites for the member that override their default permissions.

Extends: BitField

Properties

bitfield

bitfield: bigint

Bitfield of the packed bits Source

FLAGS

static

FLAGS: Object<string, bigint>

Numeric permission flags. All available properties:

  • CREATE_INSTANT_INVITE (create invitations to the guild)
  • KICK_MEMBERS
  • BAN_MEMBERS
  • ADMINISTRATOR (implicitly has all permissions, and bypasses all channel overwrites)
  • MANAGE_CHANNELS (edit and reorder channels)
  • MANAGE_GUILD (edit the guild information, region, etc.)
  • ADD_REACTIONS (add new reactions to messages)
  • VIEW_AUDIT_LOG
  • PRIORITY_SPEAKER
  • STREAM
  • VIEW_CHANNEL
  • SEND_MESSAGES
  • SEND_TTS_MESSAGES
  • MANAGE_MESSAGES (delete messages and reactions)
  • EMBED_LINKS (links posted will have a preview embedded)
  • ATTACH_FILES
  • READ_MESSAGE_HISTORY (view messages that were posted prior to opening Discord)
  • MENTION_EVERYONE
  • USE_EXTERNAL_EMOJIS (use emojis from different guilds)
  • VIEW_GUILD_INSIGHTS
  • CONNECT (connect to a voice channel)
  • SPEAK (speak in a voice channel)
  • MUTE_MEMBERS (mute members across all voice channels)
  • DEAFEN_MEMBERS (deafen members across all voice channels)
  • MOVE_MEMBERS (move members between voice channels)
  • USE_VAD (use voice activity detection)
  • CHANGE_NICKNAME
  • MANAGE_NICKNAMES (change other members' nicknames)
  • MANAGE_ROLES
  • MANAGE_WEBHOOKS
  • MANAGE_EMOJIS_AND_STICKERS
  • USE_APPLICATION_COMMANDS
  • REQUEST_TO_SPEAK
  • MANAGE_EVENTS
  • MANAGE_THREADS
  • USE_PUBLIC_THREADS (deprecated)
  • CREATE_PUBLIC_THREADS
  • USE_PRIVATE_THREADS (deprecated)
  • CREATE_PRIVATE_THREADS
  • USE_EXTERNAL_STICKERS (use stickers from different guilds)
  • SEND_MESSAGES_IN_THREADS
  • START_EMBEDDED_ACTIVITIES
  • MODERATE_MEMBERS
  • VIEW_CREATOR_MONETIZATION_ANALYTICS
  • USE_SOUNDBOARD
  • CREATE_GUILD_EXPRESSIONS
  • CREATE_EVENTS
  • USE_EXTERNAL_SOUNDS
  • SEND_VOICE_MESSAGES
  • USE_CLYDE_AI
  • SET_VOICE_CHANNEL_STATUS
  • SEND_POLLS
  • USE_EXTERNAL_APPSSource

ALL

static

ALL: bigint

Bitfield representing every permission combined Source

DEFAULT

static

DEFAULT: bigint

Bitfield representing the default permissions for users Source

STAGE_MODERATOR

static

STAGE_MODERATOR: bigint

Bitfield representing the permissions required for moderators of stage channels Source

Methods

missing

missing(bits: BitFieldResolvable, checkAdmin?: boolean): Array<string>

Gets all given bits that are missing from the bitfield. Parameters

NameTypeDescription
bitsBitFieldResolvableBit(s) to check for
checkAdmin?booleanWhether to allow the administrator permission to override Default: true.

Returns: Array<string>Source

any

any(permission: PermissionResolvable, checkAdmin?: boolean): boolean

Checks whether the bitfield has a permission, or any of multiple permissions. Parameters

NameTypeDescription
permissionPermissionResolvablePermission(s) to check for
checkAdmin?booleanWhether to allow the administrator permission to override Default: true.

Returns: booleanSource

has

has(permission: PermissionResolvable, checkAdmin?: boolean): boolean

Checks whether the bitfield has a permission, or multiple permissions. Parameters

NameTypeDescription
permissionPermissionResolvablePermission(s) to check for
checkAdmin?booleanWhether to allow the administrator permission to override Default: true.

Returns: booleanSource

toArray

toArray(): Array<string>

Gets an Array of bitfield names based on the permissions available. Returns: Array<string>Source

equals

equals(bit: BitFieldResolvable): boolean

Checks if this bitfield equals another Parameters

NameTypeDescription
bitBitFieldResolvableBit(s) to check for

Returns: booleanSource

freeze

freeze(): Readonly<BitField>

Freezes these bits, making them immutable. Returns: Readonly<BitField>Source

add

add(bits?: BitFieldResolvable): BitField

Adds bits to these ones. Parameters

NameTypeDescription
bits?BitFieldResolvableBits to add

Returns: BitField — These bits or new BitField if the instance is frozen. Source

remove

remove(bits?: BitFieldResolvable): BitField

Removes bits from these. Parameters

NameTypeDescription
bits?BitFieldResolvableBits to remove

Returns: BitField — These bits or new BitField if the instance is frozen. Source

serialize

serialize(hasParams: *): Object

Gets an object mapping field names to a boolean indicating whether the bit is available. Parameters

NameTypeDescription
hasParams*Additional parameters for the has method, if any

Returns: ObjectSource

Unofficial software. Not affiliated with or supported by Discord.