Module serenity::model::permissions [] [src]

A set of permissions for a role or user. These can be assigned directly to a role or as a channel's permission overrides.

For convenience, methods for each permission are available, which can be used to test if the set of permissions contains a single permission. This can simplify code and reduce a potential import.

Permissions follow a heirarchy:

  • An account can grant roles to users that are of a lower position than its highest role;
  • An account can edit roles lesser than its highest role, but can only grant permissions they have;
  • An account can move only roles lesser than its highest role;
  • An account can only kick/ban accounts with a lesser role than its top role.

Note: The following permissions require the owner account (e.g. the owner of a bot) to use two-factor authentication in the case that a guild has guild-wide 2FA enabled:

Structs

Permissions

Constants

ADD_REACTIONS

Members with this permission can add new Reactions to a Message. Members can still react using reactions already added to messages without this permission.

ADMINISTRATOR

Allows all permissions, bypassing channel permission overwrites.

ATTACH_FILES

Allows uploading of files.

BAN_MEMBERS

Allows the banning of guild members.

CHANGE_NICKNAME

Allows members to change their own nickname in the guild.

CONNECT

Allows the joining of a voice channel.

CREATE_INVITE

Allows for the creation of RichInvites.

DEAFEN_MEMBERS

Allows the deafening of members in a voice channel.

EMBED_LINKS

Allows links from this user - or users of this role - to be embedded, with potential data such as a thumbnail, description, and page name.

KICK_MEMBERS

Allows for the kicking of guild members.

MANAGE_CHANNELS

Allows management and editing of guild channels.

MANAGE_EMOJIS

Allows management of emojis created without the use of an Integration.

MANAGE_GUILD

Allows management and editing of the guild.

MANAGE_MESSAGES

Allows the deleting of other messages in a guild channel.

MANAGE_NICKNAMES

Allows members to change other members' nicknames.

MANAGE_ROLES

Allows management and editing of roles below their own.

MANAGE_WEBHOOKS

Allows management of webhooks.

MENTION_EVERYONE

Allows the usage of the @everyone mention, which will notify all users in a channel. The @here mention will also be available, and can be used to mention all non-offline users.

MOVE_MEMBERS

Allows the moving of members from one voice channel to another.

MUTE_MEMBERS

Allows the muting of members in a voice channel.

READ_MESSAGES

Allows reading messages in a guild channel. If a user does not have this permission, then they will not be able to see the channel.

READ_MESSAGE_HISTORY

Allows the reading of a channel's message history.

SEND_MESSAGES

Allows sending messages in a guild channel.

SEND_TTS_MESSAGES

Allows the sending of text-to-speech messages in a channel.

SPEAK

Allows the user to speak in a voice channel.

USE_EXTERNAL_EMOJIS

Allows the usage of custom emojis from other guilds.

USE_VAD

Allows the usage of voice-activity-detection in a voice channel.

Functions

general

Returns a set of permissions with the original @everyone permissions set to true.

text

Returns a set of text-only permissions with the original @everyone permissions set to true.

voice

Returns a set of voice-only permissions with the original @everyone permissions set to true.