IntentFlag

An int subclass representing the intents to receive specific events. The wrapper picks these up as well and optimizes the dispatch events' events.

Each flag specifies which parser's dispatch event is received from Discord. Not mentioned events do not depend on intent flags and they are expected to be received independently.

Intent flag position's respective nameShift valueIntent nameCorresponding parser
INTENT_SHIFT_GUILDS0guildsGUILD_CREATE, GUILD_DELETE, GUILD_UPDATE, GUILD_ROLE_CREATE, GUILD_ROLE_UPDATE, GUILD_ROLE_DELETE, CHANNEL_CREATE, CHANNEL_UPDATE, CHANNEL_DELETE, CHANNEL_PINS_UPDATE, STAGE_INSTANCE_CREATE, STAGE_INSTANCE_UPDATE, STAGE_INSTANCE_DELETE, THREAD_CREATE, THREAD_UPDATE, THREAD_DELETE, THREAD_LIST_SYNC, THREAD_MEMBER_UPDATE, THREAD_MEMBERS_UPDATE, GUILD_JOIN_REQUEST_CREATE, GUILD_JOIN_REQUEST_DELETE, GUILD_JOIN_REQUEST_UPDATE, EMBEDDED_ACTIVITY_UPDATE, CHANNEL_TOPIC_UPDATE, VOICE_CHANNEL_STATUS_UPDATE
INTENT_SHIFT_GUILD_USERS1guild_usersGUILD_MEMBER_ADD, GUILD_MEMBER_UPDATE, GUILD_MEMBER_REMOVE, THREAD_MEMBERS_UPDATE
INTENT_SHIFT_GUILD_MODERATION2guild_bansGUILD_AUDIT_LOG_ENTRY_CREATE, GUILD_BAN_ADD, GUILD_BAN_REMOVE
INTENT_SHIFT_GUILD_EXPRESSIONS3guild_expressionsGUILD_EMOJIS_UPDATE, GUILD_SOUNDBOARD_SOUND_CREATE, GUILD_SOUNDBOARD_SOUND_DELETE, GUILD_SOUNDBOARD_SOUND_UPDATE, GUILD_SOUNDBOARD_SOUNDS_UPDATE, GUILD_STICKERS_UPDATE, SOUNDBOARD_SOUNDS
INTENT_SHIFT_GUILD_INTEGRATIONS4guild_integrationsINTEGRATION_CREATE, INTEGRATION_DELETE, INTEGRATION_UPDATE, GUILD_INTEGRATIONS_UPDATE
INTENT_SHIFT_GUILD_WEBHOOKS5guild_webhooksWEBHOOKS_UPDATE
INTENT_SHIFT_GUILD_INVITES6guild_invitesINVITE_CREATE, INVITE_DELETE
INTENT_SHIFT_GUILD_VOICE_STATES7guild_voice_statesVOICE_CHANNEL_EFFECT_SEND, VOICE_STATE_UPDATE
INTENT_SHIFT_GUILD_PRESENCES8guild_presencesPRESENCE_UPDATE
INTENT_SHIFT_GUILD_MESSAGES9guild_messagesCHANNEL_PINS_UPDATE, MESSAGE_CREATE, MESSAGE_UPDATE, MESSAGE_DELETE, MESSAGE_DELETE_BULK
INTENT_SHIFT_GUILD_REACTIONS10guild_reactionsMESSAGE_REACTION_ADD, MESSAGE_REACTION_REMOVE, MESSAGE_REACTION_REMOVE_ALL, MESSAGE_REACTION_REMOVE_EMOJI
INTENT_SHIFT_GUILD_TYPINGS11guild_typingsTYPING_START
INTENT_SHIFT_DIRECT_MESSAGES12direct_messagesCHANNEL_CREATE, CHANNEL_PINS_UPDATE, MESSAGE_CREATE, MESSAGE_UPDATE, MESSAGE_DELETE
INTENT_SHIFT_DIRECT_REACTIONS13direct_reactionsMESSAGE_REACTION_ADD, MESSAGE_REACTION_REMOVE, MESSAGE_REACTION_REMOVE_ALL, MESSAGE_REACTION_REMOVE_EMOJI
INTENT_SHIFT_DIRECT_TYPINGS14direct_typingsTYPING_START
INTENT_SHIFT_MESSAGE_CONTENT15message_contentN/A
INTENT_SHIFT_GUILD_SCHEDULED_EVENTS16guild_scheduled_eventsGUILD_APPLICATION_COMMAND_COUNTS_UPDATE, GUILD_SCHEDULED_EVENT_CREATE, GUILD_SCHEDULED_EVENT_UPDATE, GUILD_SCHEDULED_EVENT_DELETE, GUILD_SCHEDULED_EVENT_USER_ADD, GUILD_SCHEDULED_EVENT_USER_REMOVE
INTENT_SHIFT_AUTO_MODERATION_CONFIGURATION20auto_moderation_configurationAUTO_MODERATION_RULE_CREATE AUTO_MODERATION_RULE_DELETE AUTO_MODERATION_RULE_UPDATE
INTENT_SHIFT_AUTO_MODERATION_EXECUTION21auto_moderation_executionAUTO_MODERATION_ACTION_EXECUTION

Properties

auto_moderation_configuration

auto_moderation_execution

direct_messages

direct_reactions

direct_typings

guild_emojis_and_stickers

guild_expressions

guild_integrations

guild_invites

guild_messages

guild_moderation

guild_presences

guild_reactions

guild_scheduled_events

guild_typings

guild_users

guild_voice_states

guild_webhooks

guilds

message_content

Methods

__new__(...)

Creates a new IntentFlag from the passed integer. If any invalid intent flag is passed, those will be removed. If the wrapper is started up without presence caching, then .guild_presences will be set to False by default.

ParameterTypeOptionalDefaultDescription
integer

int

-1

The value what will be converted IntentFlag. If not passed or passed as a negative value, then returns an IntentFlag what contains all the enabled flags.

Returns

intent_flag : IntentFlag

Raises

TypeError

If integer was not passed as int.

Notes

The default created intent flags contain the privileged gateway intents, so if you have those disabled, or if those are not allowed for you, then make sure, you specify them.

allow_auto_moderation_configuration()

allow_auto_moderation_execution()

allow_direct_messages()

allow_direct_reactions()

allow_direct_typings()

allow_guild_emojis_and_stickers()

allow_guild_expressions()

allow_guild_integrations()

allow_guild_invites()

allow_guild_messages()

allow_guild_moderation()

allow_guild_presences()

allow_guild_reactions()

allow_guild_scheduled_events()

allow_guild_typings()

allow_guild_users()

allow_guild_voice_states()

allow_guild_webhooks()

allow_guilds()

allow_message_content()

deny_auto_moderation_configuration()

deny_auto_moderation_execution()

deny_direct_messages()

deny_direct_reactions()

deny_direct_typings()

deny_guild_emojis_and_stickers()

deny_guild_expressions()

deny_guild_integrations()

deny_guild_invites()

deny_guild_messages()

deny_guild_moderation()

deny_guild_presences()

deny_guild_reactions()

deny_guild_scheduled_events()

deny_guild_typings()

deny_guild_users()

deny_guild_voice_states()

deny_guild_webhooks()

deny_guilds()

deny_message_content()

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.

iterate_parser_names()

Yields every parser's name, what the intent flag allows to be received.

This method is a generator.

Yields

parser_name : str

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.