Class: Permissions

Permissions

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.

Constructor

new Permissions()

Source:

Extends

Members

(static) ALL :number

Bitfield representing every permission combined
Type:
  • number
Source:

(static) DEFAULT :number

Bitfield representing the default permissions for users
Type:
  • number
Source:

(static) FLAGS :Object

Numeric permission flags. All available properties: * `ADMINISTRATOR` (implicitly has *all* permissions, and bypasses all channel overwrites) * `CREATE_INSTANT_INVITE` (create invitations to the guild) * `KICK_MEMBERS` * `BAN_MEMBERS` * `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`
Type:
  • Object
Source:
See:

bitfield :number

Bitfield of the packed bits
Type:
  • number
Inherited From:
Source:

Methods

add(…bitsopt) → {BitField}

Adds bits to these ones.
Parameters:
Name Type Attributes Description
bits BitFieldResolvable <optional>
<repeatable>
Bits to add
Inherited From:
Source:
Returns:
These bits or new BitField if the instance is frozen.
Type
BitField

any(permission, checkAdminopt) → {boolean}

Checks whether the bitfield has a permission, or any of multiple permissions.
Parameters:
Name Type Attributes Default Description
permission PermissionResolvable Permission(s) to check for
checkAdmin boolean <optional>
true Whether to allow the administrator permission to override
Overrides:
Source:
Returns:
Type
boolean

equals(bit) → {boolean}

Checks if this bitfield equals another
Parameters:
Name Type Description
bit BitFieldResolvable Bit(s) to check for
Inherited From:
Source:
Returns:
Type
boolean

freeze() → {Readonly.<BitField>}

Freezes these bits, making them immutable.
Inherited From:
Source:
Returns:
These bits
Type
Readonly.<BitField>

has(permission, checkAdminopt) → {boolean}

Checks whether the bitfield has a permission, or multiple permissions.
Parameters:
Name Type Attributes Default Description
permission PermissionResolvable Permission(s) to check for
checkAdmin boolean <optional>
true Whether to allow the administrator permission to override
Overrides:
Source:
Returns:
Type
boolean

missing(bits, …hasParams) → {Array.<string>}

Gets all given bits that are missing from the bitfield.
Parameters:
Name Type Attributes Description
bits BitFieldResolvable Bit(s) to check for
hasParams * <repeatable>
Additional parameters for the has method, if any
Inherited From:
Source:
Returns:
Type
Array.<string>

remove(…bitsopt) → {BitField}

Removes bits from these.
Parameters:
Name Type Attributes Description
bits BitFieldResolvable <optional>
<repeatable>
Bits to remove
Inherited From:
Source:
Returns:
These bits or new BitField if the instance is frozen.
Type
BitField

serialize(…hasParams) → {Object}

Gets an object mapping field names to a boolean indicating whether the bit is available.
Parameters:
Name Type Attributes Description
hasParams * <repeatable>
Additional parameters for the has method, if any
Inherited From:
Source:
Returns:
Type
Object

toArray(…hasParams) → {Array.<string>}

Gets an Array of bitfield names based on the bits available.
Parameters:
Name Type Attributes Description
hasParams * <repeatable>
Additional parameters for the has method, if any
Inherited From:
Source:
Returns:
Type
Array.<string>