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 name | Shift value | Intent name | Corresponding parser |
---|---|---|---|
INTENT_SHIFT_GUILDS | 0 | guilds | GUILD_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_USERS | 1 | guild_users | GUILD_MEMBER_ADD, GUILD_MEMBER_UPDATE, GUILD_MEMBER_REMOVE, THREAD_MEMBERS_UPDATE |
INTENT_SHIFT_GUILD_MODERATION | 2 | guild_bans | GUILD_AUDIT_LOG_ENTRY_CREATE, GUILD_BAN_ADD, GUILD_BAN_REMOVE |
INTENT_SHIFT_GUILD_EXPRESSIONS | 3 | guild_expressions | GUILD_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_INTEGRATIONS | 4 | guild_integrations | INTEGRATION_CREATE, INTEGRATION_DELETE, INTEGRATION_UPDATE, GUILD_INTEGRATIONS_UPDATE |
INTENT_SHIFT_GUILD_WEBHOOKS | 5 | guild_webhooks | WEBHOOKS_UPDATE |
INTENT_SHIFT_GUILD_INVITES | 6 | guild_invites | INVITE_CREATE, INVITE_DELETE |
INTENT_SHIFT_GUILD_VOICE_STATES | 7 | guild_voice_states | VOICE_CHANNEL_EFFECT_SEND, VOICE_STATE_UPDATE |
INTENT_SHIFT_GUILD_PRESENCES | 8 | guild_presences | PRESENCE_UPDATE |
INTENT_SHIFT_GUILD_MESSAGES | 9 | guild_messages | CHANNEL_PINS_UPDATE, MESSAGE_CREATE, MESSAGE_UPDATE, MESSAGE_DELETE, MESSAGE_DELETE_BULK |
INTENT_SHIFT_GUILD_REACTIONS | 10 | guild_reactions | MESSAGE_REACTION_ADD, MESSAGE_REACTION_REMOVE, MESSAGE_REACTION_REMOVE_ALL, MESSAGE_REACTION_REMOVE_EMOJI |
INTENT_SHIFT_GUILD_TYPINGS | 11 | guild_typings | TYPING_START |
INTENT_SHIFT_DIRECT_MESSAGES | 12 | direct_messages | CHANNEL_CREATE, CHANNEL_PINS_UPDATE, MESSAGE_CREATE, MESSAGE_UPDATE, MESSAGE_DELETE |
INTENT_SHIFT_DIRECT_REACTIONS | 13 | direct_reactions | MESSAGE_REACTION_ADD, MESSAGE_REACTION_REMOVE, MESSAGE_REACTION_REMOVE_ALL, MESSAGE_REACTION_REMOVE_EMOJI |
INTENT_SHIFT_DIRECT_TYPINGS | 14 | direct_typings | TYPING_START |
INTENT_SHIFT_MESSAGE_CONTENT | 15 | message_content | N/A |
INTENT_SHIFT_GUILD_SCHEDULED_EVENTS | 16 | guild_scheduled_events | GUILD_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_CONFIGURATION | 20 | auto_moderation_configuration | AUTO_MODERATION_RULE_CREATE AUTO_MODERATION_RULE_DELETE AUTO_MODERATION_RULE_UPDATE |
INTENT_SHIFT_AUTO_MODERATION_EXECUTION | 21 | auto_moderation_execution | AUTO_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.
Parameter | Type | Optional | Default | Description |
---|---|---|---|---|
integer |
|
| The value what will be converted |
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_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.
()
iterate_parser_namesYields every parser's name, what the intent flag allows to be received.
This method is a generator.
Yields
parser_name : str
()
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.