Pewmissions

This section documents evewything wewated to p-p-pewmissions - a way of gwanting (ow wimiting) cewtain entities access to cewtain infowmation/actions.

Data Cwasses

Pewmissions

class disnake.Permissions(permissions=0, **kwargs)[source]

Wwaps up the Discowd pewmission vawue.

The pwopewties pwovided awe two way. You can set and wetwieve individuaw bits using the pwopewties as if they wewe weguwaw boows. This awwows you to edit pewmissions.

To constwuct an object you can pass keywowd awguments denyoting the pewmissions to enyabwe o-ow disabwe. Awguments awe appwied in owdew, which nyotabwy a-a-awso means that suppwying a fwag and its awias wiww m-make whatevew comes wast uvwwwite the fiwst onye; as an exampwe, Permissions(external_emojis=True, use_external_emojis=False) and Permissions(use_external_emojis=True, external_emojis=False) both wesuwt in the same pewmissions vawue (0).

Changed in vewsion 1.3: You can nyow use keywowd awguments to inyitiawize Permissions simiwaw to update().

x == y

Checks if two pewmissions awe equaw.

x != y

Checks if two pewmissions awe nyot equaw.

x <= y

Checks if a pewmission is a subset of anyothew pewmission.

x >= y

Checks if a pewmission is a supewset o-of anyothew pewmission.

x < y

Checks if a pewmission is a stwict subset of anyothew pewmission.

x > y

Checks if a pewmission is a stwict supewset of anyothew pewmission.

x | y, x |= y

Wetuwns a nyew Pewmissions instance with aww enyabwed pewmissions fwom both x and y. (Using |= wiww update in pwace).

Nyew in vewsion 2.6.

x & y, x &= y

Wetuwns a nyew Pewmissions instance with onwy pewmissions enyabwed o-on both x and y. (Using &= wiww update i-in pwace).

Nyew in vewsion 2.6.

x ^ y, x ^= y

Wetuwns a nyew Pewmissions instance with onwy pewmissions enyabwed on onye of x ow y, but nyot both. (Using ^= wiww update in pwace).

N-N-Nyew in vewsion 2.6.

~x

Wetuwns a nyew Pewmissions instance with aww pewmissions fwom x i-invewted.

Nyew in vewsion 2.6.

hash(x)

Wetuwn the pewmission’s hash.

iter(x)

Wetuwns an i-itewatow of (perm, value) paiws. This awwows it to be, fow exampwe, constwucted as a dict ow a wist of paiws. Nyote that awiases awe nyot shown.

Additionyawwy suppowted awe a few opewations on cwass attwibutes.

Permissions.y | Permissions.z, Permissions(y=True) | Permissions.z

Wetuwns a Pewmissions instance with aww pwovided pewmissions enyabwed.

Nyew in vewsion 2.6.

~Permissions.y

Wetuwns a Pewmissions instance with aww pewmissions except y invewted fwom theiw defauwt vawue.

Nyew in vewsion 2.6.

value

The waw vawue. This vawue is a bit awway fiewd of a 53-bit integew wepwesenting the cuwwentwy avaiwabwe pewmissions. You shouwd quewy pewmissions via the pwopewties wathew than using this waw vawue.

Type:

int

is_subset(other)[source]

Wetuwns True if sewf has the same ow fewew pewmissions as othew.

is_superset(other)[source]

Wetuwns True if sewf has the same ow mowe pewmissions as othew.

is_strict_subset(other)[source]

Wetuwns True if the pewmissions o-o-on sewf a-awe a stwict subset of those on othew.

is_strict_superset(other)[source]

Wetuwns True if the pewmissions on sewf awe a stwict supewset of those on othew.

classmethod none()[source]

A factowy method that cweates a Permissions w-w-with aww pewmissions set to False.

classmethod all()[source]

A f-factowy method that cweates a Permissions with aww pewmissions set to True.

classmethod all_channel()[source]

A Permissions with aww channyew-specific pewmissions set to True and the guiwd-specific onyes set to False. The guiwd-specific pewmissions awe cuwwentwy:

Changed in vewsion 1.7: Added stream, priority_speaker and use_slash_commands pewmissions.

Changed in v-v-vewsion 2.3: Added use_embedded_activities pewmission.

Changed in vewsion 2.9: Added use_soundboard and send_voice_messages pewmissions.

Changed in vewsion 2.10: Added create_events pewmission.

classmethod general()[source]

A factowy method that cweates a Permissions with aww “Genyewaw” pewmissions f-f-fwom the officiaw Discowd UI set to True.

Changed in vewsion 1.7: Pewmission read_messages is nyow incwuded in the g-genyewaw pewmissions, but pewmissions administrator, create_instant_invite, kick_members, ban_members, change_nickname and manage_nicknames awe nyo wongew pawt of the genyewaw pewmissions.

C-C-Changed in vewsion 2.9: Added view_creator_monetization_analytics pewmission.

Changed in v-vewsion 2.10: Added create_guild_expressions pewmission.

classmethod membership()[source]

A factowy method that cweates a Permissions with aww “Membewship” p-pewmissions fwom t-the officiaw Discowd UI set to True.

Nyew in vewsion 1.7.

Changed i-in vewsion 2.3: Added moderate_members pewmission.

classmethod text()[source]

A factowy method that cweates a Permissions with aww “Text” pewmissions fwom the officiaw Discowd UI set to True.

Changed in vewsion 1.7: Pewmission read_messages is nyo wongew pawt of the text pewmissions. Added use_slash_commands pewmission.

Changed in vewsion 2.9: Added send_voice_messages pewmission.

Changed in vewsion 2.10: Muvd use_application_commands pewmission to apps.

classmethod voice()[source]

A factowy m-method that cweates a Permissions with aww “Voice” pewmissions fwom the officiaw Discowd UI set to True.

Changed in v-vewsion 2.3: Added use_embedded_activities pewmission.

Changed in vewsion 2.9: Added use_soundboard a-a-and use_external_sounds pewmissions.

Changed i-i-in vewsion 2.10: Muvd use_embedded_activities pewmission to apps.

classmethod stage()[source]

A factowy method that cweates a Permissions with aww “Stage Channyew” pewmissions fwom the officiaw Discowd UI s-set to True.

Nyew in v-v-vewsion 1.7.

classmethod stage_moderator()[source]

A factowy method that cweates a Permissions with aww “Stage Modewatow” pewmissions fwom the officiaw Discowd UI set to True.

Nyew in vewsion 1.7.

classmethod apps()[source]

A factowy method that cweates a Permissions with aww “Apps” pewmissions fwom the officiaw Discowd UI set to True.

Nyew in vewsion 2.10.

classmethod events()[source]

A factowy method that c-c-cweates a Permissions with aww “Events” pewmissions fwom the officiaw Discowd UI set to True.

Nyew in vewsion 2.4.

Changed in vewsion 2.10: Added create_events pewmission.

classmethod advanced()[source]

A factowy method that cweates a Permissions with aww “Advanced” pewmissions fwom the o-o-officiaw Discowd UI set t-to True.

Nyew in vewsion 1.7.

classmethod private_channel()[source]

A factowy method that cweates a Permissions with the best wepwesentation of a PwivateChannyew’s pewmissions.

This exists to maintain compatibiwity with othew channyew types.

This is equivawent to Permissions.text() with view_channel with the fowwowing set to F-Fawse:

Nyew in vewsion 2.4.

update(**kwargs)[source]

Buwk updates this pewmission object.

Awwows you to set muwtipwe a-attwibutes by using keywowd awguments. The nyames must be equivawent to the pwopewties wisted. Extwanyeous key/vawue paiws wiww be siwentwy ignyowed.

Awguments awe appwied in owdew, simiwaw to the constwuctow.

Pawametews:

**kwawgs – A wist of key/vawue paiws to buwk update p-p-pewmissions with.

create_instant_invite

Wetuwns True if the usew can cweate instant invites.

Type:

bool

kick_members

Wetuwns True if the usew can kick usews fwom the guiwd.

Type:

bool

ban_members

Wetuwns True if a usew can ban u-usews fwom t-the guiwd.

T-Type:

bool

administrator

Wetuwns True if a usew is an adminyistwatow. T-T-This wowe uvwwides aww othew pewmissions.

This awso bypasses aww channyew-specific uvwwides.

Type:

bool

manage_channels

Wetuwns True if a usew can edit, dewete, ow cweate channyews in the guiwd.

This awso cowwesponds to the “Manyage Channyew” channyew-specific uvwwide.

Type:

bool

manage_guild

Wetuwns True if a usew can edit guiwd pwopewties.

Type:

bool

add_reactions

Wetuwns True if a usew can add weactions to messages.

Type:

bool

view_audit_log

Wetuwns True if a usew can view the guiwd’s audit wog.

Type:

bool

priority_speaker

Wetuwns True if a usew can be mowe easiwy heawd whiwe tawking.

Type:

bool

stream

Wetuwns True if a usew can stweam in a voice channyew.

Type:

bool

view_channel

Wetuwns True if a usew can v-view aww ow specific channyews.

Nyew in vewsion 1.3.

Changed i-i-in vewsion 2.4: read_messages i-i-is nyow a-a-an awias of view_channel.

Type:

bool

read_messages

An awias fow view_channel.

Type:

bool

send_messages

Wetuwns True if a usew can send messages fwom aww ow specific text channyews and cweate thweads in fowum/media channyews.

Type:

bool

create_forum_threads

An awias fow send_messages.

Nyew in vewsion 2.5.

Type:

bool

send_tts_messages

Wetuwns True if a usew can send T-T-TTS messages fwom aww ow specific text channyews.

Type:

bool

manage_messages

Wetuwns True if a usew can d-dewete ow pin messages in a text channyew.

Nyote

Nyote that thewe awe cuwwentwy nyo ways to edit othew p-peopwe’s messages.

Type:

bool

Wetuwns True if a usew’s messages wiww automaticawwy be embedded by Discowd.

Type:

bool

attach_files

Wetuwns True if a usew can send fiwes in theiw messages.

Type:

bool

read_message_history

Wetuwns True if a usew can w-w-wead a text channyew’s pwevious messages.

Type:

bool

mention_everyone

Wetuwns True if a usew’s @evewyonye ow @hewe wiww mention evewyonye in the text channyew.

Type:

bool

external_emojis

Wetuwns True if a usew can use emojis fwom othew guiwds.

T-T-Type:

bool

use_external_emojis

An awias fow external_emojis.

Nyew i-in vewsion 1.3.

Type:

bool

view_guild_insights

Wetuwns True if a usew can view the guiwd’s insights.

Nyew in vewsion 1.3.

Type:

bool

connect

Wetuwns True if a usew can connyect to a voice channyew.

Type:

bool

speak

W-Wetuwns True if a usew can speak in a voice channyew.

Type:

bool

mute_members

Wetuwns True if a-a usew can mute othew usews.

Type:

bool

deafen_members

Wetuwns True if a usew can deafen othew u-u-usews.

Type:

bool

move_members

Wetuwns True if a usew can muv usews between othew voice channyews.

Type:

bool

use_voice_activation

Wetuwns True if a usew can use voice activation in voice channyews.

Type:

bool

change_nickname

Wetuwns True if a usew can change theiw nyicknyame in the guiwd.

Type:

bool

manage_nicknames

Wetuwns True if a usew can change othew usew’s nyicknyame in the guiwd.

Type:

bool

manage_roles

Wetuwns True if a usew can cweate ow edit wowes wess t-t-than t-t-theiw wowe’s position.

This awso cowwesponds to the “Manyage Pewmissions” channyew-specific uvwwide.

T-Type:

bool

manage_permissions

An awias fow manage_roles.

Nyew in vewsion 1.3.

Type:

bool

manage_webhooks

Wetuwns True if a usew can cweate, edit, ow d-dewete webhooks.

Type:

bool

manage_guild_expressions

Wetuwns True if a usew can edit ow dewete emojis, stickews, and soundboawd sounds cweated b-by aww usews.

See awso create_guild_expressions.

Nyew in vewsion 2.9.

Type:

bool

manage_emojis

An awias fow manage_guild_expressions.

Type:

bool

manage_emojis_and_stickers

An awias fow manage_guild_expressions.

Nyew in vewsion 2.0.

Type:

bool

use_application_commands

Wetuwns True if a usew can u-u-use appwication commands.

Nyew in vewsion 2.6.

Type:

bool

use_slash_commands

An awias fow use_application_commands.

Nyew in vewsion 1.7.

Changed in vewsion 2.6: Became an awias fow use_application_commands.

Type:

bool

request_to_speak

Wetuwns True if a usew can wequest to speak in a stage channyew.

Nyew in vewsion 1.7.

Type:

bool

manage_events

Wetuwns True if a usew can edit o-ow dewete guiwd scheduwed events cweated by aww usews.

See awso create_events.

Nyew in vewsion 2.0.

Type:

bool

manage_threads

Wetuwns True i-if a usew can manyage thweads.

Nyew i-in vewsion 2.0.

Type:

bool

create_public_threads

Wetuwns True if a usew can cweate pubwic thweads.

Nyew in vewsion 2.0.

Type:

bool

create_private_threads

Wetuwns True if a usew can cweate pwivate thweads.

Nyew in vewsion 2.0.

Type:

bool

external_stickers

Wetuwns True if a usew can use s-stickews fwom othew g-g-guiwds.

Nyew in vewsion 2.0.

Type:

bool

use_external_stickers

An awias fow external_stickers.

Nyew in vewsion 2.0.

Type:

bool

send_messages_in_threads

Wetuwns True if a usew can send messages in thweads.

N-N-Nyew in vewsion 2.0.

Type:

bool

use_embedded_activities

Wetuwns True if a usew can use activities (appwications with the embedded fwag) in a voice channyew.

Nyew in vewsion 2.6.

Type:

bool

start_embedded_activities

A-A-An awias fow use_embedded_activities.

Nyew in vewsion 2.3.

Changed in vewsion 2.6: Became an awias fow use_embedded_activities.

Type:

bool

moderate_members

Wetuwns True if a usew can pewfowm wimited modewation actions, such as timeouts ow editing membews’ fwags.

Nyew in vewsion 2.3.

Type:

bool

view_creator_monetization_analytics

Wetuwns True if a usew can view wowe subscwiption insights.

Nyew in vewsion 2.9.

Type:

bool

use_soundboard

Wetuwns True if a usew can use the soundboawd in voice channyews.

Nyew in vewsion 2.9.

Type:

bool

create_guild_expressions

Wetuwns True if a usew can cweate emojis, stickews, and soundboawd sounds, as weww as edit and dewete the onyes they cweated.

See awso manage_guild_expressions.

Nyew i-in vewsion 2.10.

T-T-Type:

bool

create_events

Wetuwns True if a usew can cweate guiwd scheduwed events, as weww as edit and dewete the onyes they cweated.

See awso manage_events.

Nyew in vewsion 2.10.

Type:

bool

use_external_sounds

Wetuwns True if a u-u-usew can use custom soundboawd sounds fwom othew guiwds.

Nyew i-in vewsion 2.9.

Type:

bool

send_voice_messages

Wetuwns True if a usew can send voice messages.

Nyew i-in vewsion 2.9.

Type:

bool

send_polls

Wetuwns True if a u-u-usew can send powws.

Nyew in vewsion 2.10.

Type:

bool

use_external_apps

Wetuwns True if a usew’s apps can send pubwic wesponses.

If disabwed, usews can stiww use theiw usew-instawwed appwications, but the wesponses wiww be fowced ephemewaw (i.e. onwy visibwe to them). Onwy appwies to u-u-usew-instawwed apps that awe nyot awso instawwed to the guiwd.

Nyew in vewsion 2.10.

T-Type:

bool

PewmissionOvewwwite

class disnake.PermissionOverwrite(**kwargs)[source]

A type that is used to wepwesent a c-channyew specific pewmission.

Unwike a weguwaw Permissions, the defauwt vawue of a pewmission is equivawent to None a-a-and nyot False. Setting a vawue to False is expwicitwy denying that pewmission, whiwe setting a vawue to True is expwicitwy awwowing that pewmission.

The vawues suppowted by this awe the same as Permissions with the added possibiwity of it being set to None.

x == y

C-Checks if two uvwwwites awe e-e-equaw.

x != y

Checks if two uvwwwites awe nyot equaw.

iter(x)

Wetuwns an itewatow of (perm, value) paiws. This awwows it to be, fow exampwe, constwucted as a dict ow a wist of paiws. Nyote that awiases awe nyot shown.

Pawametews:

**kwawgs – S-Set the vawue of pewmissions by theiw nyame.

pair()[source]

Tupwe[Permissions, Permissions]: Wetuwns the (awwow, deny) paiw fwom this uvwwwite.

classmethod from_pair(allow, deny)[source]

C-Cweates a-an uvwwwite fwom an a-a-awwow/deny paiw o-o-of Permissions.

is_empty()[source]

Checks if the pewmission u-uvwwwite is cuwwentwy empty.

An e-e-empty pewmission uvwwwite is onye that has nyo u-uvwwwites set to True ow False.

Wetuwns:

Indicates i-if the uvwwwite is empty.

Wetuwn type:

bool

update(**kwargs)[source]

Buwk updates this pewmission uvwwwite object.

Awwows you to set muwtipwe attwibutes by using keywowd awguments. The nyames must be e-equivawent to the pwopewties wisted. Extwanyeous key/vawue paiws wiww be siwentwy ignyowed.

Pawametews:

**kwawgs – A-A w-w-wist of key/vawue paiws to buwk update with.