Permissions¶
This section documents everything related to permissions - a way of granting (or limiting) certain entities access to certain information/actions.
Data Classes¶
Permissions¶
- add_reactions
- administrator
- attach_files
- ban_members
- change_nickname
- connect
- create_events
- create_forum_threads
- create_guild_expressions
- create_instant_invite
- create_private_threads
- create_public_threads
- deafen_members
- embed_links
- external_emojis
- external_stickers
- kick_members
- manage_channels
- manage_emojis
- manage_emojis_and_stickers
- manage_events
- manage_guild
- manage_guild_expressions
- manage_messages
- manage_nicknames
- manage_permissions
- manage_roles
- manage_threads
- manage_webhooks
- mention_everyone
- moderate_members
- move_members
- mute_members
- pin_messages
- priority_speaker
- read_message_history
- read_messages
- request_to_speak
- send_messages
- send_messages_in_threads
- send_polls
- send_tts_messages
- send_voice_messages
- speak
- start_embedded_activities
- stream
- use_application_commands
- use_embedded_activities
- use_external_apps
- use_external_emojis
- use_external_sounds
- use_external_stickers
- use_slash_commands
- use_soundboard
- use_voice_activation
- value
- view_audit_log
- view_channel
- view_creator_monetization_analytics
- view_guild_insights
- clsPermissions.advanced
- clsPermissions.all
- clsPermissions.all_channel
- clsPermissions.apps
- clsPermissions.events
- clsPermissions.general
- clsPermissions.membership
- clsPermissions.none
- clsPermissions.private_channel
- clsPermissions.stage
- clsPermissions.stage_moderator
- clsPermissions.text
- clsPermissions.voice
- defis_strict_subset
- defis_strict_superset
- defis_subset
- defis_superset
- defupdate
- class disnake.Permissions(permissions=0, **kwargs)[source]¶
- Wraps up the Discord permission value. - The properties provided are two way. You can set and retrieve individual bits using the properties as if they were regular bools. This allows you to edit permissions. - To construct an object you can pass keyword arguments denoting the permissions to enable or disable. Arguments are applied in order, which notably also means that supplying a flag and its alias will make whatever comes last overwrite the first one; as an example, - Permissions(external_emojis=True, use_external_emojis=False)and- Permissions(use_external_emojis=True, external_emojis=False)both result in the same permissions value (- 0).- Changed in version 1.3: You can now use keyword arguments to initialize - Permissionssimilar to- update().- x == y
- Checks if two permissions are equal. 
 - x != y
- Checks if two permissions are not equal. 
 - x <= y
- Checks if a permission is a subset of another permission. 
 - x >= y
- Checks if a permission is a superset of another permission. 
 - x < y
- Checks if a permission is a strict subset of another permission. 
 - x > y
- Checks if a permission is a strict superset of another permission. 
 - x | y, x |= y
- Returns a new Permissions instance with all enabled permissions from both x and y. (Using - |=will update in place).- New in version 2.6. 
 - x & y, x &= y
- Returns a new Permissions instance with only permissions enabled on both x and y. (Using - &=will update in place).- New in version 2.6. 
 - x ^ y, x ^= y
- Returns a new Permissions instance with only permissions enabled on one of x or y, but not both. (Using - ^=will update in place).- New in version 2.6. 
 - ~x
- Returns a new Permissions instance with all permissions from x inverted. - New in version 2.6. 
 - hash(x)
- Return the permission’s hash. 
 - iter(x)
- Returns an iterator of - (perm, value)pairs. This allows it to be, for example, constructed as a dict or a list of pairs. Note that aliases are not shown.
 - Additionally supported are a few operations on class attributes. - Permissions.y | Permissions.z, Permissions(y=True) | Permissions.z
- Returns a Permissions instance with all provided permissions enabled. - New in version 2.6. 
 - ~Permissions.y
- Returns a Permissions instance with all permissions except - yinverted from their default value.- New in version 2.6. 
 - value¶
- The raw value. This value is a bit array field of a 53-bit integer representing the currently available permissions. You should query permissions via the properties rather than using this raw value. - Type:
 
 - is_strict_subset(other)[source]¶
- Returns - Trueif the permissions on self are a strict subset of those on other.
 - is_strict_superset(other)[source]¶
- Returns - Trueif the permissions on self are a strict superset of those on other.
 - classmethod none()[source]¶
- A factory method that creates a - Permissionswith all permissions set to- False.
 - classmethod all()[source]¶
- A factory method that creates a - Permissionswith all permissions set to- True.
 - classmethod all_channel()[source]¶
- A - Permissionswith all channel-specific permissions set to- Trueand the guild-specific ones set to- False. The guild-specific permissions are currently:- Changed in version 1.7: Added - stream,- priority_speakerand- use_slash_commandspermissions.- Changed in version 2.0: Added - create_public_threads,- create_private_threads,- manage_threads,- use_external_stickers,- send_messages_in_threadsand- request_to_speakpermissions.- Changed in version 2.3: Added - use_embedded_activitiespermission.- Changed in version 2.9: Added - use_soundboardand- send_voice_messagespermissions.- Changed in version 2.10: Added - create_eventspermission.
 - classmethod general()[source]¶
- A factory method that creates a - Permissionswith all “General” permissions from the official Discord UI set to- True.- Changed in version 1.7: Permission - read_messagesis now included in the general permissions, but permissions- administrator,- create_instant_invite,- kick_members,- ban_members,- change_nicknameand- manage_nicknamesare no longer part of the general permissions.- Changed in version 2.9: Added - view_creator_monetization_analyticspermission.- Changed in version 2.10: Added - create_guild_expressionspermission.
 - classmethod membership()[source]¶
- A factory method that creates a - Permissionswith all “Membership” permissions from the official Discord UI set to- True.- New in version 1.7. - Changed in version 2.3: Added - moderate_memberspermission.
 - classmethod text()[source]¶
- A factory method that creates a - Permissionswith all “Text” permissions from the official Discord UI set to- True.- Changed in version 1.7: Permission - read_messagesis no longer part of the text permissions. Added- use_slash_commandspermission.- Changed in version 2.0: Added - create_public_threads,- create_private_threads,- manage_threads,- send_messages_in_threadsand- use_external_stickerspermissions.- Changed in version 2.9: Added - send_voice_messagespermission.- Changed in version 2.10: Moved - use_application_commandspermission to- apps.- Changed in version 2.11: Added - pin_messagespermission.
 - classmethod voice()[source]¶
- A factory method that creates a - Permissionswith all “Voice” permissions from the official Discord UI set to- True.- Changed in version 2.3: Added - use_embedded_activitiespermission.- Changed in version 2.9: Added - use_soundboardand- use_external_soundspermissions.- Changed in version 2.10: Moved - use_embedded_activitiespermission to- apps.
 - classmethod stage()[source]¶
- A factory method that creates a - Permissionswith all “Stage Channel” permissions from the official Discord UI set to- True.- New in version 1.7. 
 - classmethod stage_moderator()[source]¶
- A factory method that creates a - Permissionswith all “Stage Moderator” permissions from the official Discord UI set to- True.- New in version 1.7. 
 - classmethod apps()[source]¶
- A factory method that creates a - Permissionswith all “Apps” permissions from the official Discord UI set to- True.- New in version 2.10. 
 - classmethod events()[source]¶
- A factory method that creates a - Permissionswith all “Events” permissions from the official Discord UI set to- True.- New in version 2.4. - Changed in version 2.10: Added - create_eventspermission.
 - classmethod advanced()[source]¶
- A factory method that creates a - Permissionswith all “Advanced” permissions from the official Discord UI set to- True.- New in version 1.7. 
 - classmethod private_channel()[source]¶
- A factory method that creates a - Permissionswith the best representation of a PrivateChannel’s permissions.- This exists to maintain compatibility with other channel types. - This is equivalent to - Permissions.text()with- view_channelwith the following set to False:- send_tts_messages: You cannot send TTS messages in a DM.
- manage_messages: You cannot delete others messages in a DM.
- manage_threads: You cannot manage threads in a DM.
- send_messages_in_threads: You cannot make threads in a DM.
- create_public_threads: You cannot make public threads in a DM.
- create_private_threads: You cannot make private threads in a DM.
 - New in version 2.4. 
 - update(**kwargs)[source]¶
- Bulk updates this permission object. - Allows you to set multiple attributes by using keyword arguments. The names must be equivalent to the properties listed. Extraneous key/value pairs will be silently ignored. - Arguments are applied in order, similar to the constructor. - Parameters:
- **kwargs – A list of key/value pairs to bulk update permissions with. 
 
 - administrator¶
- Returns - Trueif a user is an administrator. This role overrides all other permissions.- This also bypasses all channel-specific overrides. - Type:
 
 - manage_channels¶
- Returns - Trueif a user can edit, delete, or create channels in the guild.- This also corresponds to the “Manage Channel” channel-specific override. - Type:
 
 - view_channel¶
- Returns - Trueif a user can view all or specific channels.- New in version 1.3. - Changed in version 2.4: - read_messagesis now an alias of- view_channel.- Type:
 
 - read_messages¶
- An alias for - view_channel.- Type:
 
 - send_messages¶
- Returns - Trueif a user can send messages from all or specific text channels and create threads in forum/media channels.- Type:
 
 - create_forum_threads¶
- An alias for - send_messages.- New in version 2.5. - Type:
 
 - send_tts_messages¶
- Returns - Trueif a user can send TTS messages from all or specific text channels.- Type:
 
 - manage_messages¶
- Returns - Trueif a user can delete messages in a text channel.- Note - Note that there are currently no ways to edit other people’s messages. - Type:
 
 - embed_links¶
- Returns - Trueif a user’s messages will automatically be embedded by Discord.- Type:
 
 - read_message_history¶
- Returns - Trueif a user can read a text channel’s previous messages.- Type:
 
 - mention_everyone¶
- Returns - Trueif a user’s @everyone or @here will mention everyone in the text channel.- Type:
 
 - use_external_emojis¶
- An alias for - external_emojis.- New in version 1.3. - Type:
 
 - view_guild_insights¶
- Returns - Trueif a user can view the guild’s insights.- New in version 1.3. - Type:
 
 - manage_roles¶
- Returns - Trueif a user can create or edit roles less than their role’s position.- This also corresponds to the “Manage Permissions” channel-specific override. - Type:
 
 - manage_permissions¶
- An alias for - manage_roles.- New in version 1.3. - Type:
 
 - manage_guild_expressions¶
- Returns - Trueif a user can edit or delete emojis, stickers, and soundboard sounds created by all users.- See also - create_guild_expressions.- New in version 2.9. - Type:
 
 - manage_emojis¶
- An alias for - manage_guild_expressions.- Type:
 
 - manage_emojis_and_stickers¶
- An alias for - manage_guild_expressions.- New in version 2.0. - Type:
 
 - use_application_commands¶
- Returns - Trueif a user can use application commands.- New in version 2.6. - Type:
 
 - use_slash_commands¶
- An alias for - use_application_commands.- New in version 1.7. - Changed in version 2.6: Became an alias for - use_application_commands.- Type:
 
 - request_to_speak¶
- Returns - Trueif a user can request to speak in a stage channel.- New in version 1.7. - Type:
 
 - manage_events¶
- Returns - Trueif a user can edit or delete guild scheduled events created by all users.- See also - create_events.- New in version 2.0. - Type:
 
 - create_public_threads¶
- Returns - Trueif a user can create public threads.- New in version 2.0. - Type:
 
 - create_private_threads¶
- Returns - Trueif a user can create private threads.- New in version 2.0. - Type:
 
 - external_stickers¶
- Returns - Trueif a user can use stickers from other guilds.- New in version 2.0. - Type:
 
 - use_external_stickers¶
- An alias for - external_stickers.- New in version 2.0. - Type:
 
 - send_messages_in_threads¶
- Returns - Trueif a user can send messages in threads.- New in version 2.0. - Type:
 
 - use_embedded_activities¶
- Returns - Trueif a user can use activities (applications with the- embeddedflag) in a voice channel.- New in version 2.6. - Type:
 
 - start_embedded_activities¶
- An alias for - use_embedded_activities.- New in version 2.3. - Changed in version 2.6: Became an alias for - use_embedded_activities.- Type:
 
 - moderate_members¶
- Returns - Trueif a user can perform limited moderation actions, such as timeouts or editing members’ flags.- New in version 2.3. - Type:
 
 - view_creator_monetization_analytics¶
- Returns - Trueif a user can view role subscription insights.- New in version 2.9. - Type:
 
 - use_soundboard¶
- Returns - Trueif a user can use the soundboard in voice channels.- New in version 2.9. - Type:
 
 - create_guild_expressions¶
- Returns - Trueif a user can create emojis, stickers, and soundboard sounds, as well as edit and delete the ones they created.- See also - manage_guild_expressions.- New in version 2.10. - Type:
 
 - create_events¶
- Returns - Trueif a user can create guild scheduled events, as well as edit and delete the ones they created.- See also - manage_events.- New in version 2.10. - Type:
 
 - use_external_sounds¶
- Returns - Trueif a user can use custom soundboard sounds from other guilds.- New in version 2.9. - Type:
 
 - use_external_apps¶
- Returns - Trueif a user’s apps can send public responses.- If disabled, users can still use their user-installed applications, but the responses will be forced ephemeral (i.e. only visible to them). Only applies to user-installed apps that are not also installed to the guild. - New in version 2.10. - Type:
 
 
PermissionOverwrite¶
- clsPermissionOverwrite.from_pair
- defis_empty
- defpair
- defupdate
- class disnake.PermissionOverwrite(**kwargs)[source]¶
- A type that is used to represent a channel specific permission. - Unlike a regular - Permissions, the default value of a permission is equivalent to- Noneand not- False. Setting a value to- Falseis explicitly denying that permission, while setting a value to- Trueis explicitly allowing that permission.- The values supported by this are the same as - Permissionswith the added possibility of it being set to- None.- x == y
- Checks if two overwrites are equal. 
 - x != y
- Checks if two overwrites are not equal. 
 - iter(x)
- Returns an iterator of - (perm, value)pairs. This allows it to be, for example, constructed as a dict or a list of pairs. Note that aliases are not shown.
 - Parameters:
- **kwargs – Set the value of permissions by their name. 
 - pair()[source]¶
- tuple[- Permissions,- Permissions]: Returns the (allow, deny) pair from this overwrite.
 - classmethod from_pair(allow, deny)[source]¶
- Creates an overwrite from an allow/deny pair of - Permissions.
 - is_empty()[source]¶
- Checks if the permission overwrite is currently empty. - An empty permission overwrite is one that has no overwrites set to - Trueor- False.- Returns:
- Indicates if the overwrite is empty. 
- Return type:
 
 - update(**kwargs)[source]¶
- Bulk updates this permission overwrite object. - Allows you to set multiple attributes by using keyword arguments. The names must be equivalent to the properties listed. Extraneous key/value pairs will be silently ignored. - Parameters:
- **kwargs – A list of key/value pairs to bulk update with.