permissionsBitfield

To prevent that members can execute commands which they shouldn't, you can check if the member has certain permissions. Discord makes use of a bitfield, which basically is a large number from which you can extract whether the member has the required permissions or not. As these numbers are hard to remind, you can import the permissionsBitfield object, which has as the key an easy to understand name for the permission and as the value the number which defines the permission. Here is an overview from the permissions:

Permission keyDescription

AddReactions

Whether the member has the permissions to add a reaction or emoji underneath a message or not.

Administrator

Whether the member has adminisitrator permissions or not. Members with administrator permissions, have permissions to do everything which is possible in the server.

AttachFiles

Whether the member is allowed to attach files to it's messages or not.

BanMembers

Whether the member can ban other members or not which makes the banned members unable to join the server again, unless they get unbanned.

ChangeNickname

Whether the member is allowed to change its own nickname or not.

Connect

Whether the member is allowed to join voice channels or not.

CreateInstantInvite

Whether the member is allowed to create server invites or not which lead directly to text-, voice- or stagechannels.

CreatePrivateThreads

Whether the member is allowed to create private thread channels or not.

CreatePublicThreads

Whether the member is allowed to create public thread channels or not.

DeafenMembers

Whether the member can server-deafen other members or not in voice-based channels. Server-deafened members cannot hear anything in voice-based channels anymore until a member with the DeafenMembers permission undefeans the member. (Voice- and stagechannels are voice-based channels)

EmbedLinks

Whether the links that the member sends, may be converted to an embed or not.

KickMembers

Whether the member can kick other members or not. Kicked members will be removed from the server, but can rejoin the server again with an invite.

ManageChannels

Whether the member can change permissions and other things like the position of channels or not.

ManageEmojisAndStickers

Whether the member is allowed to create, edit and remove emoji's and stickers or not.

ManageEvents

Whether the member is allowed to create, ediit and remove server events or not.

ManageGuild

Whether the member is allowed to make changes to the server or not.

ManageGuildExpressions

Whether the member is allowed to create, edit and remove emoji's, stickers and soundboard sounds or not.

ManageMessages

Whether the member is allowed to delete messages written by other members or not.

ManageNicknames

Whether the member is allowed to change the nicknames of other members or not.

ManageRoles

Whether the member is allowed to create, edit and remove roles in the server or not.

ManageThreads

Whether the member is allowed to remove and archive all thread channels and view all private threads or not.

ManageWebhooks

Whether the member is allowed to create, edit and remove webhooks in channels or not.

MentionEveryone

Whether the member is allowed to use the @everyone tag or not.

ModerateMembers

Whether the member is allowed to mute and unmute other members or not.

MoveMembers

Whether the member is allowed to move members who are in a voice channel to another voice channel or not.

MuteMembers

Whether the member is allowed to server-mute other members in a voice-based channel or not. Server-muted members cannot speak in voice-based channels until a member with the MuteMembers permission unmutes the member. (Voice- and stagechannels are voice-based channels)

PrioritySpeaker

Whether the member can use the priority speaker in a voice channel or not. When a member uses priority speaker, the volume of all the other members will be lowered when this member starts speaking.

ReadMessageHistory

Whether the member is allowed to view older messages in channels or not.

RequestToSpeak

Whether the member may ask to speak in stagechannels or not. When a member asks this, a speaker must allow it first before the member can actually start speaking.

SendMessages

Whether the member is allowed to send messages in channels or not.

SendMessagesInThreads

Whether the member is allowed to send messages in thread channels or not.

SendTTSMessages

Whether the member is allowed to send messages which convert to audio messages spoken by a robot voice or not.

SendVoiceMessages

Whether the member is allowed to send messages in voice channels or not.

Speak

Whether the member is allowed to speak in a voice-based channel or not.

Stream

Whether the member is allowed to start a screenshare in a voice-based channel or not.

UseApplicationCommands

Whether the member is allowed to use slash commands or not.

UseEmbeddedActivities

Whether the member is allowed to play activities in a voice-based channel which has the EMBEDDED flag or not.

UseExternalEmojis

Whether the member is allowed to use emoji's from different Discord servers or not.

UseExternalSounds

Whether the member is allowed to use soundboard sounds from different Discord servers or not in voice-based channels. (Voice- and stagechannels are voice-based channels)

UseSoundboard

Whether the member is allowed to use the soundboard in voice-based channels or not. (Voice- and stagechannels are voice-based channels)

UseVAD

Whether the member is allowed to use voice activity as the input type for their microphone in a voice channel or not.

ViewAuditLog

Whether the member is allowed to view the audit logs or not. The audit logs show all actions which were performed in the Discord server and also shwo by whom and can show additional reasons when they were given.

ViewChannel

Whether the member is allowed to view a certain channel or not.

ViewCreatorMonetizationAnalytics

Whether the member is allowed to see the insights of the role subscriptions of the Discord server or not.

ViewGuildInsights

Whether the member is allowed to see the statistics of the Discord server, like joins and leaves in a certain month, or not.

Last updated