Permission
Represents a Discord permission.
The implemented permissions are the following:
Respective name | Bitwise position |
---|---|
create_instant_invite | 0 |
kick_users | 1 |
ban_users | 2 |
administrator | 3 |
manage_channels | 4 |
manage_guild | 5 |
add_reactions | 6 |
view_audit_logs | 7 |
priority_speaker | 8 |
stream | 9 |
view_channel | 10 |
send_messages | 11 |
send_tts_messages | 12 |
manage_messages | 13 |
embed_links | 14 |
attach_files | 15 |
read_message_history | 16 |
mention_everyone | 17 |
use_external_emojis | 18 |
connect | 20 |
speak | 21 |
mute_users | 22 |
deafen_users | 23 |
move_users | 24 |
use_voice_activation | 25 |
change_nickname | 26 |
manage_nicknames | 27 |
manage_roles | 28 |
manage_webhooks | 29 |
manage_guild_expressions | 30 |
use_application_commands | 31 |
request_to_speak | 32 |
manage_events | 33 |
manage_threads | 34 |
create_public_threads | 35 |
create_private_threads | 36 |
use_external_stickers | 37 |
send_messages_in_threads | 38 |
use_embedded_activities | 39 |
moderate_users | 40 |
view_creator_monetization_analytics | 41 |
use_soundboard | 42 |
create_guild_expressions | 43 |
create_events | 44 |
use_external_sounds | 45 |
send_voice_messages | 46 |
user_clyde_ai | 47 |
set_voice_channel_status | 48 |
Each permission can be accessed as property with can_
+ it's respective name, meanwhile a new edited permission can be created with the allow_...
and with the deny_...
methods.
Properties
can_add_reactions
can_administrator
can_attach_files
can_ban_users
can_change_nickname
can_connect
can_create_events
can_create_guild_expressions
can_create_instant_invite
can_create_private_threads
can_create_public_threads
can_deafen_users
can_embed_links
can_kick_users
can_manage_channels
can_manage_emojis_and_stickers
can_manage_events
can_manage_guild
can_manage_guild_expressions
can_manage_messages
can_manage_nicknames
can_manage_roles
can_manage_threads
can_manage_webhooks
can_mention_everyone
can_moderate_users
can_move_users
can_mute_users
can_priority_speaker
can_read_message_history
can_request_to_speak
can_send_messages
can_send_messages_in_threads
can_send_tts_messages
can_send_voice_messages
can_set_voice_channel_status
can_speak
can_stream
can_use_application_commands
can_use_clyde_ai
can_use_embedded_activities
can_use_external_emojis
can_use_external_sounds
can_use_external_stickers
can_use_soundboard
can_use_voice_activation
can_view_audit_logs
can_view_channel
can_view_creator_monetization_analytics
can_view_guild_insights
Methods
()
allow_add_reactions()
allow_administrator()
allow_attach_files()
allow_ban_users()
allow_change_nickname()
allow_connect()
allow_create_events()
allow_create_guild_expressions()
allow_create_instant_invite()
allow_create_private_threads()
allow_create_public_threads()
allow_deafen_users()
allow_embed_links()
allow_kick_users()
allow_manage_channels()
allow_manage_emojis_and_stickers()
allow_manage_events()
allow_manage_guild()
allow_manage_guild_expressions()
allow_manage_messages()
allow_manage_nicknames()
allow_manage_roles()
allow_manage_threads()
allow_manage_webhooks()
allow_mention_everyone()
allow_moderate_users()
allow_move_users()
allow_mute_users()
allow_priority_speaker()
allow_read_message_history()
allow_request_to_speak()
allow_send_messages()
allow_send_messages_in_threads()
allow_send_tts_messages()
allow_send_voice_messages()
allow_set_voice_channel_status()
allow_speak()
allow_stream()
allow_use_application_commands()
allow_use_clyde_ai()
allow_use_embedded_activities()
allow_use_external_emojis()
allow_use_external_sounds()
allow_use_external_stickers()
allow_use_soundboard()
allow_use_voice_activation()
allow_view_audit_logs()
allow_view_channel()
allow_view_creator_monetization_analytics()
allow_view_guild_insights()
deny_add_reactions()
deny_administrator()
deny_attach_files()
deny_ban_users()
deny_change_nickname()
deny_connect()
deny_create_events()
deny_create_guild_expressions()
deny_create_instant_invite()
deny_create_private_threads()
deny_create_public_threads()
deny_deafen_users()
deny_embed_links()
deny_kick_users()
deny_manage_channels()
deny_manage_emojis_and_stickers()
deny_manage_events()
deny_manage_guild()
deny_manage_guild_expressions()
deny_manage_messages()
deny_manage_nicknames()
deny_manage_roles()
deny_manage_threads()
deny_manage_webhooks()
deny_mention_everyone()
deny_moderate_users()
deny_move_users()
deny_mute_users()
deny_priority_speaker()
deny_read_message_history()
deny_request_to_speak()
deny_send_messages()
deny_send_messages_in_threads()
deny_send_tts_messages()
deny_send_voice_messages()
deny_set_voice_channel_status()
deny_speak()
deny_stream()
deny_use_application_commands()
deny_use_clyde_ai()
deny_use_embedded_activities()
deny_use_external_emojis()
deny_use_external_sounds()
deny_use_external_stickers()
deny_use_soundboard()
deny_use_voice_activation()
deny_view_audit_logs()
deny_view_channel()
deny_view_creator_monetization_analytics()
deny_view_guild_insights()
is_strict_subsetReturns whether self has more flags disabled than other.
()
is_strict_supersetReturns whether self has more flags enabled than other.
()
is_subsetReturns whether self has the same amount or more flags disabled than other.
()
is_supersetReturns whether self has the same amount or more flags enabled than other.
()
itemsYields the items of the flag.
This method is a generator.
Yields
name : str
The name of the specific flag
enabled : int
(0
, 1
)
Whether the specific bitwise value is enabled.
()
keysYields the name of the bitwise flags, which are enabled.
This method is a generator.
Yields
name : str
(...)
update_by_keysUpdates the source value with the given flags and returns a new one.
Parameter | Type | Optional | Keyword only | Description |
---|---|---|---|---|
**keyword_parameters | Keyword parameters |
|
Returns
flag : FlagBase
Raises
LookupError
If a keyword is invalid.
Examples
>>> from hata import Permission
>>> perm = Permission().update_by_keys(kick_users = True, ban_users = True)
>>> list(perm)
['kick_users', 'ban_users']
>>> perm = perm.update_by_keys(manage_roles = True, kick_users = False)
>>> list(perm)
['ban_users', 'manage_roles']
()
valuesYields the shift values of the flags, under which shift value the flag is enabled.
This method is a generator.
Yields
shift : int
(keys)
_get_shift_ofGets the shift value for the given keys.
Parameter | Type | Description |
---|---|---|
keys |
| The key's name. |
Returns
shift : int
Raises
LookupError
- Invalid key given.
()
__contains__Returns whether the specific flag of the given name is enabled.
(name, shift, deprecation_info)
__disabler_factory__Creates a flag disabler function.
Parameter | Type | Description |
---|---|---|
name |
| The flag's name. |
shift |
| Bit shift value. |
deprecation_info |
| Deprecation info for the field if deprecated. |
Returns
flag_disabler : FunctionType
(name, shift, deprecation_info)
__enabler_factory__Creates a flag enabler function.
Parameter | Type | Description |
---|---|---|
name |
| The flag's name. |
shift |
| Bit shift value. |
deprecation_info |
| Deprecation info for the field if deprecated. |
Returns
flag_enabler : FunctionType
()
__ge__Returns whether self has the same amount or more flags enabled than other.
()
__getitem__Returns whether a specific flag of the given name is enabled.
(name, shift, deprecation_info)
__getter_factory__Creates a flag getter function.
Parameter | Type | Description |
---|---|---|
name |
| The flag's name. |
shift |
| Bit shift value. |
deprecation_info |
| Deprecation info for the field if deprecated. |
Returns
flag_getter : FunctionType
()
__gt__Returns whether self has more flags enabled than other.
()
__iter__Yields the name of the bitwise flags, which are enabled.
This method is a generator.
Yields
name : str
()
__le__Returns whether self has the same amount or more flags disabled than other.
()
__lt__Returns whether self has more flags disabled than other.
()
__repr__Returns the representation of the flag.