Permission

Represents a Discord permission.

The implemented permissions are the following:

Respective nameBitwise position
create_instant_invite0
kick_users1
ban_users2
administrator3
manage_channels4
manage_guild5
add_reactions6
view_audit_logs7
priority_speaker8
stream9
view_channel10
send_messages11
send_tts_messages12
manage_messages13
embed_links14
attach_files15
read_message_history16
mention_everyone17
use_external_emojis18
connect20
speak21
mute_users22
deafen_users23
move_users24
use_voice_activation25
change_nickname26
manage_nicknames27
manage_roles28
manage_webhooks29
manage_guild_expressions30
use_application_commands31
request_to_speak32
manage_events33
manage_threads34
create_public_threads35
create_private_threads36
use_external_stickers37
send_messages_in_threads38
use_embedded_activities39
moderate_users40
view_creator_monetization_analytics41
use_soundboard42
create_guild_expressions43
create_events44
use_external_sounds45
send_voice_messages46
user_clyde_ai47
set_voice_channel_status48

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_subset()

Returns whether self has more flags disabled than other.

is_strict_superset()

Returns whether self has more flags enabled than other.

is_subset()

Returns whether self has the same amount or more flags disabled than other.

is_superset()

Returns whether self has the same amount or more flags enabled than other.

items()

Yields 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.

keys()

Yields the name of the bitwise flags, which are enabled.

This method is a generator.

Yields

name : str

update_by_keys(...)

Updates the source value with the given flags and returns a new one.

ParameterTypeOptionalKeyword onlyDescription
**keyword_parameters

Keyword parameters

flag-name- bool relations.

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']

values()

Yields the shift values of the flags, under which shift value the flag is enabled.

This method is a generator.

Yields

shift : int

_get_shift_of(keys)

Gets the shift value for the given keys.

ParameterTypeDescription
keys

str

The key's name.

Returns

shift : int

Raises

LookupError

  • Invalid key given.

__contains__()

Returns whether the specific flag of the given name is enabled.

__disabler_factory__(name, shift, deprecation_info)

Creates a flag disabler function.

ParameterTypeDescription
name

str

The flag's name.

shift

int

Bit shift value.

deprecation_info

None, tuple(str, str)

Deprecation info for the field if deprecated.

Returns

flag_disabler : FunctionType

__enabler_factory__(name, shift, deprecation_info)

Creates a flag enabler function.

ParameterTypeDescription
name

str

The flag's name.

shift

int

Bit shift value.

deprecation_info

None, tuple(str, str)

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.

__getter_factory__(name, shift, deprecation_info)

Creates a flag getter function.

ParameterTypeDescription
name

str

The flag's name.

shift

int

Bit shift value.

deprecation_info

None, tuple(str, str)

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.