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 of the packed bits Source
FLAGS
static
Numeric permission flags. All available properties:
CREATE_INSTANT_INVITE(create invitations to the guild)KICK_MEMBERSBAN_MEMBERSADMINISTRATOR(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_LOGPRIORITY_SPEAKERSTREAMVIEW_CHANNELSEND_MESSAGESSEND_TTS_MESSAGESMANAGE_MESSAGES(delete messages and reactions)EMBED_LINKS(links posted will have a preview embedded)ATTACH_FILESREAD_MESSAGE_HISTORY(view messages that were posted prior to opening Discord)MENTION_EVERYONEUSE_EXTERNAL_EMOJIS(use emojis from different guilds)VIEW_GUILD_INSIGHTSCONNECT(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_NICKNAMEMANAGE_NICKNAMES(change other members' nicknames)MANAGE_ROLESMANAGE_WEBHOOKSMANAGE_EMOJIS_AND_STICKERSUSE_APPLICATION_COMMANDSREQUEST_TO_SPEAKMANAGE_EVENTSMANAGE_THREADSUSE_PUBLIC_THREADS(deprecated)CREATE_PUBLIC_THREADSUSE_PRIVATE_THREADS(deprecated)CREATE_PRIVATE_THREADSUSE_EXTERNAL_STICKERS(use stickers from different guilds)SEND_MESSAGES_IN_THREADSSTART_EMBEDDED_ACTIVITIESMODERATE_MEMBERSVIEW_CREATOR_MONETIZATION_ANALYTICSUSE_SOUNDBOARDCREATE_GUILD_EXPRESSIONSCREATE_EVENTSUSE_EXTERNAL_SOUNDSSEND_VOICE_MESSAGESUSE_CLYDE_AISET_VOICE_CHANNEL_STATUSSEND_POLLSUSE_EXTERNAL_APPSSource
ALL
static
Bitfield representing every permission combined Source
DEFAULT
static
Bitfield representing the default permissions for users Source
STAGE_MODERATOR
static
Bitfield representing the permissions required for moderators of stage channels Source
Methods
missing
Gets all given bits that are missing from the bitfield. Parameters
| Name | Type | Description |
|---|---|---|
bits | BitFieldResolvable | Bit(s) to check for |
checkAdmin? | boolean | Whether to allow the administrator permission to override Default: true. |
Returns: Array<string>Source
any
Checks whether the bitfield has a permission, or any of multiple permissions. Parameters
| Name | Type | Description |
|---|---|---|
permission | PermissionResolvable | Permission(s) to check for |
checkAdmin? | boolean | Whether to allow the administrator permission to override Default: true. |
Returns: booleanSource
has
Checks whether the bitfield has a permission, or multiple permissions. Parameters
| Name | Type | Description |
|---|---|---|
permission | PermissionResolvable | Permission(s) to check for |
checkAdmin? | boolean | Whether to allow the administrator permission to override Default: true. |
Returns: booleanSource
toArray
Gets an Array of bitfield names based on the permissions available. Returns: Array<string>Source
equals
Checks if this bitfield equals another Parameters
| Name | Type | Description |
|---|---|---|
bit | BitFieldResolvable | Bit(s) to check for |
Returns: booleanSource
freeze
Freezes these bits, making them immutable. Returns: Readonly<BitField>Source
add
Adds bits to these ones. Parameters
| Name | Type | Description |
|---|---|---|
bits? | BitFieldResolvable | Bits to add |
Returns: BitField — These bits or new BitField if the instance is frozen. Source
remove
Removes bits from these. Parameters
| Name | Type | Description |
|---|---|---|
bits? | BitFieldResolvable | Bits to remove |
Returns: BitField — These bits or new BitField if the instance is frozen. Source
serialize
Gets an object mapping field names to a boolean indicating whether the bit is available. Parameters
| Name | Type | Description |
|---|---|---|
hasParams | * | Additional parameters for the has method, if any |
Returns: ObjectSource