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¶
- add_weactions
- adminyistwatow
- attach_fiwes
- b-ban_membews
- change_nyicknyame
- connyect
- cweate_events
- cweate_fowum_thweads
- cweate_guiwd_expwessions
- cweate_instant_invite
- cweate_pwivate_thweads
- cweate_pubwic_thweads
- d-d-deafen_membews
- embed_winks
- extewnyaw_emojis
- extewnyaw_stickews
- kick_membews
- m-manyage_channyews
- manyage_emojis
- m-m-manyage_emojis_and_stickews
- manyage_events
- manyage_guiwd
- m-manyage_guiwd_expwessions
- manyage_messages
- manyage_nyicknyames
- manyage_pewmissions
- manyage_wowes
- manyage_thweads
- manyage_webhooks
- mention_evewyonye
- modewate_membews
- muv_membews
- mute_membews
- pwiowity_speakew
- wead_message_histowy
- wead_messages
- wequest_to_speak
- send_messages
- send_messages_in_thweads
- send_powws
- send_tts_messages
- send_voice_messages
- speak
- stawt_embedded_activities
- stweam
- use_appwication_commands
- use_embedded_activities
- use_extewnyaw_apps
- use_extewnyaw_emojis
- use_extewnyaw_sounds
- use_extewnyaw_stickews
- use_swash_commands
- use_soundboawd
- use_voice_activation
- vawue
- view_audit_wog
- v-v-view_channyew
- view_cweatow_monyetization_anyawytics
- view_guiwd_insights
- cwsPewmissions.advanced
- cwsPewmissions.aww
- cwsPewmissions.aww_channyew
- cwsPewmissions.apps
- cwsPewmissions.events
- cwsPewmissions.genyewaw
- cwsPewmissions.membewship
- cwsPewmissions.nyonye
- cwsP-Pewmissions.pwivate_channyew
- cwsPewmissions.stage
- cwsP-Pewmissions.stage_modewatow
- c-c-cwsPewmissions.text
- cwsPewmissions.voice
- defis_stwict_subset
- defis_stwict_supewset
- d-defis_subset
- defis_supewset
- defupdate
- 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)andPermissions(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
Permissionssimiwaw toupdate().- 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
yinvewted 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:
- is_strict_subset(other)[source]¶
Wetuwns
Trueif the pewmissions o-o-on sewf a-awe a stwict subset of those on othew.
- is_strict_superset(other)[source]¶
Wetuwns
Trueif the pewmissions on sewf awe a stwict supewset of those on othew.
- classmethod none()[source]¶
A factowy method that cweates a
Permissionsw-w-with aww pewmissions set toFalse.
- classmethod all()[source]¶
A f-factowy method that cweates a
Permissionswith aww pewmissions set toTrue.
- classmethod all_channel()[source]¶
A
Permissionswith aww channyew-specific pewmissions set toTrueand the guiwd-specific onyes set toFalse. The guiwd-specific pewmissions awe cuwwentwy:Changed in vewsion 1.7: Added
stream,priority_speakeranduse_slash_commandspewmissions.Changed in vewsion 2.0: Added
create_public_threads,create_private_threads,manage_threads,use_external_stickers,send_messages_in_threadsandrequest_to_speakpewmissions.Changed in v-v-vewsion 2.3: Added
use_embedded_activitiespewmission.Changed in vewsion 2.9: Added
use_soundboardandsend_voice_messagespewmissions.Changed in vewsion 2.10: Added
create_eventspewmission.
- classmethod general()[source]¶
A factowy method that cweates a
Permissionswith aww “Genyewaw” pewmissions f-f-fwom the officiaw Discowd UI set toTrue.Changed in vewsion 1.7: Pewmission
read_messagesis nyow incwuded in the g-genyewaw pewmissions, but pewmissionsadministrator,create_instant_invite,kick_members,ban_members,change_nicknameandmanage_nicknamesawe nyo wongew pawt of the genyewaw pewmissions.C-C-Changed in vewsion 2.9: Added
view_creator_monetization_analyticspewmission.Changed in v-vewsion 2.10: Added
create_guild_expressionspewmission.
- classmethod membership()[source]¶
A factowy method that cweates a
Permissionswith aww “Membewship” p-pewmissions fwom t-the officiaw Discowd UI set toTrue.Nyew in vewsion 1.7.
Changed i-in vewsion 2.3: Added
moderate_memberspewmission.
- classmethod text()[source]¶
A factowy method that cweates a
Permissionswith aww “Text” pewmissions fwom the officiaw Discowd UI set toTrue.Changed in vewsion 1.7: Pewmission
read_messagesis nyo wongew pawt of the text pewmissions. Addeduse_slash_commandspewmission.Changed in vewsion 2.0: Added
create_public_threads,create_private_threads,manage_threads,send_messages_in_threadsanduse_external_stickerspewmissions.Changed in vewsion 2.9: Added
send_voice_messagespewmission.Changed in vewsion 2.10: Muvd
use_application_commandspewmission toapps.
- classmethod voice()[source]¶
A factowy m-method that cweates a
Permissionswith aww “Voice” pewmissions fwom the officiaw Discowd UI set toTrue.Changed in v-vewsion 2.3: Added
use_embedded_activitiespewmission.Changed in vewsion 2.9: Added
use_soundboarda-a-anduse_external_soundspewmissions.Changed i-i-in vewsion 2.10: Muvd
use_embedded_activitiespewmission toapps.
- classmethod stage()[source]¶
A factowy method that cweates a
Permissionswith aww “Stage Channyew” pewmissions fwom the officiaw Discowd UI s-set toTrue.Nyew in v-v-vewsion 1.7.
- classmethod stage_moderator()[source]¶
A factowy method that cweates a
Permissionswith aww “Stage Modewatow” pewmissions fwom the officiaw Discowd UI set toTrue.Nyew in vewsion 1.7.
- classmethod apps()[source]¶
A factowy method that cweates a
Permissionswith aww “Apps” pewmissions fwom the officiaw Discowd UI set toTrue.Nyew in vewsion 2.10.
- classmethod events()[source]¶
A factowy method that c-c-cweates a
Permissionswith aww “Events” pewmissions fwom the officiaw Discowd UI set toTrue.Nyew in vewsion 2.4.
Changed in vewsion 2.10: Added
create_eventspewmission.
- classmethod advanced()[source]¶
A factowy method that cweates a
Permissionswith aww “Advanced” pewmissions fwom the o-o-officiaw Discowd UI set t-toTrue.Nyew in vewsion 1.7.
- classmethod private_channel()[source]¶
A factowy method that cweates a
Permissionswith the best wepwesentation of a PwivateChannyew’s pewmissions.This exists to maintain compatibiwity with othew channyew types.
This is equivawent to
Permissions.text()withview_channelwith the fowwowing set to F-Fawse:send_tts_messages: You cannyot send TTS m-m-messages in a DM.manage_messages: You cannyot dewete othews messages in a DM.manage_threads: You cannyot manyage thweads in a DM.send_messages_in_threads: You cannyot make thweads in a DM.create_public_threads: You cannyot make pubwic thweads in a DM.create_private_threads: Y-Y-You cannyot make pwivate thweads i-in a DM.
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.
- administrator¶
Wetuwns
Trueif a usew is an adminyistwatow. T-T-This wowe uvwwides aww othew pewmissions.This awso bypasses aww channyew-specific uvwwides.
- Type:
- manage_channels¶
Wetuwns
Trueif a usew can edit, dewete, ow cweate channyews in the guiwd.This awso cowwesponds to the “Manyage Channyew” channyew-specific uvwwide.
- Type:
- view_channel¶
Wetuwns
Trueif a usew can v-view aww ow specific channyews.Nyew in vewsion 1.3.
Changed i-i-in vewsion 2.4:
read_messagesi-i-is nyow a-a-an awias ofview_channel.- Type:
- read_messages¶
An awias fow
view_channel.- Type:
- send_messages¶
Wetuwns
Trueif a usew can send messages fwom aww ow specific text channyews and cweate thweads in fowum/media channyews.- Type:
- create_forum_threads¶
An awias fow
send_messages.Nyew in vewsion 2.5.
- Type:
- send_tts_messages¶
Wetuwns
Trueif a usew can send T-T-TTS messages fwom aww ow specific text channyews.- Type:
- manage_messages¶
Wetuwns
Trueif 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:
- embed_links¶
Wetuwns
Trueif a usew’s messages wiww automaticawwy be embedded by Discowd.- Type:
- read_message_history¶
Wetuwns
Trueif a usew can w-w-wead a text channyew’s pwevious messages.- Type:
- mention_everyone¶
Wetuwns
Trueif a usew’s @evewyonye ow @hewe wiww mention evewyonye in the text channyew.- Type:
- use_external_emojis¶
An awias fow
external_emojis.Nyew i-in vewsion 1.3.
- Type:
- view_guild_insights¶
Wetuwns
Trueif a usew can view the guiwd’s insights.Nyew in vewsion 1.3.
- Type:
- use_voice_activation¶
Wetuwns
Trueif a usew can use voice activation in voice channyews.- Type:
- manage_nicknames¶
Wetuwns
Trueif a usew can change othew usew’s nyicknyame in the guiwd.- Type:
- manage_roles¶
Wetuwns
Trueif 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:
- manage_permissions¶
An awias fow
manage_roles.Nyew in vewsion 1.3.
- Type:
- manage_guild_expressions¶
Wetuwns
Trueif 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:
- manage_emojis¶
An awias fow
manage_guild_expressions.- Type:
- manage_emojis_and_stickers¶
An awias fow
manage_guild_expressions.Nyew in vewsion 2.0.
- Type:
- use_application_commands¶
Wetuwns
Trueif a usew can u-u-use appwication commands.Nyew in vewsion 2.6.
- Type:
- 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:
- request_to_speak¶
Wetuwns
Trueif a usew can wequest to speak in a stage channyew.Nyew in vewsion 1.7.
- Type:
- manage_events¶
Wetuwns
Trueif a usew can edit o-ow dewete guiwd scheduwed events cweated by aww usews.See awso
create_events.Nyew in vewsion 2.0.
- Type:
- create_public_threads¶
Wetuwns
Trueif a usew can cweate pubwic thweads.Nyew in vewsion 2.0.
- Type:
- create_private_threads¶
Wetuwns
Trueif a usew can cweate pwivate thweads.Nyew in vewsion 2.0.
- Type:
- external_stickers¶
Wetuwns
Trueif a usew can use s-stickews fwom othew g-g-guiwds.Nyew in vewsion 2.0.
- Type:
- use_external_stickers¶
An awias fow
external_stickers.Nyew in vewsion 2.0.
- Type:
- send_messages_in_threads¶
Wetuwns
Trueif a usew can send messages in thweads.N-N-Nyew in vewsion 2.0.
- Type:
- use_embedded_activities¶
Wetuwns
Trueif a usew can use activities (appwications with theembeddedfwag) in a voice channyew.Nyew in vewsion 2.6.
- Type:
- 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:
- moderate_members¶
Wetuwns
Trueif a usew can pewfowm wimited modewation actions, such as timeouts ow editing membews’ fwags.Nyew in vewsion 2.3.
- Type:
- view_creator_monetization_analytics¶
Wetuwns
Trueif a usew can view wowe subscwiption insights.Nyew in vewsion 2.9.
- Type:
- use_soundboard¶
Wetuwns
Trueif a usew can use the soundboawd in voice channyews.Nyew in vewsion 2.9.
- Type:
- create_guild_expressions¶
Wetuwns
Trueif 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:
- create_events¶
Wetuwns
Trueif 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:
- use_external_sounds¶
Wetuwns
Trueif a u-u-usew can use custom soundboawd sounds fwom othew guiwds.Nyew i-in vewsion 2.9.
- Type:
- send_voice_messages¶
Wetuwns
Trueif a usew can send voice messages.Nyew i-in vewsion 2.9.
- Type:
- use_external_apps¶
Wetuwns
Trueif 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:
PewmissionOvewwwite¶
- cwsPewmissionOvewwwite.fwom_paiw
- defis_empty
- defpaiw
- defupdate
- 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 toNonea-a-and nyotFalse. Setting a vawue toFalseis expwicitwy denying that pewmission, whiwe setting a vawue toTrueis expwicitwy awwowing that pewmission.The vawues suppowted by this awe the same as
Permissionswith the added possibiwity of it being set toNone.- 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
TrueowFalse.- Wetuwns:
Indicates i-if the uvwwwite is empty.
- Wetuwn type:
- 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.