Skip to content

hikari.impl.entity_factory#

Basic implementation of an entity factory for general bots and HTTP apps.

EntityFactoryImpl #

EntityFactoryImpl(app: RESTAware)

Bases: EntityFactory

Standard implementation for a serializer/deserializer.

This will convert objects to/from JSON compatible representations.

app property #

app: RESTAware

Object of the application this entity factory is bound to.

deserialize_application #

deserialize_application(payload: JSONObject) -> Application

Parse a raw payload from Discord into an application object.

PARAMETER DESCRIPTION
payload

The JSON payload to deserialize.

TYPE: JSONObject

RETURNS DESCRIPTION
Application

The deserialized application object.

deserialize_application_connection_metadata_record #

deserialize_application_connection_metadata_record(payload: JSONObject) -> ApplicationRoleConnectionMetadataRecord

Parse a raw payload from Discord into an application connection metadata record object.

PARAMETER DESCRIPTION
payload

The JSON payload to deserialize.

TYPE: JSONObject

RETURNS DESCRIPTION
ApplicationRoleConnectionMetadataRecord

The deserialized "application connection metadata record" object.

deserialize_application_webhook #

deserialize_application_webhook(payload: JSONObject) -> ApplicationWebhook

Parse a raw payload from Discord into an application webhook object.

PARAMETER DESCRIPTION
payload

The JSON payload to deserialize.

TYPE: JSONObject

RETURNS DESCRIPTION
ApplicationWebhook

The parsed application webhook object.

deserialize_audit_log #

deserialize_audit_log(payload: JSONObject, *, guild_id: Snowflake) -> AuditLog

Parse a raw payload from Discord into an audit log object.

PARAMETER DESCRIPTION
payload

The JSON payload to deserialize.

TYPE: JSONObject

guild_id

The ID of the guild this audit log belongs to.

TYPE: Snowflake

RETURNS DESCRIPTION
AuditLog

The deserialized audit log object.

deserialize_audit_log_entry #

deserialize_audit_log_entry(payload: JSONObject, *, guild_id: UndefinedOr[Snowflake] = undefined.UNDEFINED) -> AuditLogEntry

Parse a raw payload from Discord into an audit log entry object.

PARAMETER DESCRIPTION
payload

The JSON payload to deserialize.

TYPE: JSONObject

guild_id

The ID of the guild this entry belongs to. If passed then this will be prioritised over "guild_id" in the payload.

TYPE: UndefinedOr[Snowflake] DEFAULT: UNDEFINED

RETURNS DESCRIPTION
AuditLogEntry

The deserialized audit log entry object.

RAISES DESCRIPTION
KeyError

If guild_id is left as hikari.undefined.UNDEFINED when "guild_id" is not present in the passed payload.

deserialize_authorization_information #

deserialize_authorization_information(payload: JSONObject) -> AuthorizationInformation

Parse a raw payload from Discord into an authorization information object.

PARAMETER DESCRIPTION
payload

The JSON payload to deserialize.

TYPE: JSONObject

RETURNS DESCRIPTION
AuthorizationInformation

The deserialized authorization information object.

deserialize_authorization_token #

deserialize_authorization_token(payload: JSONObject) -> OAuth2AuthorizationToken

Parse a raw payload from Discord into an authorization token object.

PARAMETER DESCRIPTION
payload

The JSON payload to deserialize.

TYPE: JSONObject

RETURNS DESCRIPTION
OAuth2AuthorizationToken

The deserialized OAuth2 authorization token object.

deserialize_autocomplete_interaction #

deserialize_autocomplete_interaction(payload: JSONObject) -> AutocompleteInteraction

Parse a raw payload from Discord into an autocomplete interaction object.

PARAMETER DESCRIPTION
payload

The JSON payload to deserialize.

TYPE: JSONObject

RETURNS DESCRIPTION
AutocompleteInteraction

The deserialized autocomplete interaction object.

deserialize_channel #

deserialize_channel(payload: JSONObject, *, guild_id: UndefinedOr[Snowflake] = undefined.UNDEFINED) -> PartialChannel

Parse a raw payload from Discord into a channel object.

Note

This also deserializes to thread channels.

PARAMETER DESCRIPTION
payload

The JSON payload to deserialize.

TYPE: JSONObject

guild_id

The ID of the guild this channel belongs to. This will be ignored for DM and group DM channels and will be prioritised over "guild_id" in the payload when passed.

This is necessary in GUILD_CREATE events, where "guild_id" is not included in the channel's payload

TYPE: UndefinedOr[Snowflake] DEFAULT: UNDEFINED

RETURNS DESCRIPTION
PartialChannel

The deserialized partial channel-derived object.

RAISES DESCRIPTION
KeyError

If guild_id is left as hikari.undefined.UNDEFINED when "guild_id" is not present in the passed payload of a guild channel.

UnrecognisedEntityError

If the channel type is unknown.

deserialize_channel_follow #

deserialize_channel_follow(payload: JSONObject) -> ChannelFollow

Parse a raw payload from Discord into a channel follow object.

PARAMETER DESCRIPTION
payload

The JSON payload to deserialize.

TYPE: JSONObject

RETURNS DESCRIPTION
ChannelFollow

The deserialized channel follow object.

deserialize_channel_follower_webhook #

deserialize_channel_follower_webhook(payload: JSONObject) -> ChannelFollowerWebhook

Parse a raw payload from Discord into a channel follower webhook object.

PARAMETER DESCRIPTION
payload

The JSON payload to deserialize.

TYPE: JSONObject

RETURNS DESCRIPTION
ChannelFollowerWebhook

The parsed channel follower webhook object.

deserialize_command #

deserialize_command(payload: JSONObject, *, guild_id: UndefinedNoneOr[Snowflake] = undefined.UNDEFINED) -> PartialCommand

Parse a raw payload from Discord into a command object.

PARAMETER DESCRIPTION
payload

The JSON payload to deserialize.

TYPE: JSONObject

guild_id

The ID of the guild this command belongs to. If this is specified then this will be prioritised over "guild_id" in the payload.

TYPE: UndefinedNoneOr[Snowflake] DEFAULT: UNDEFINED

RETURNS DESCRIPTION
PartialCommand

The deserialized command object.

RAISES DESCRIPTION
KeyError

If guild_id is left as hikari.undefined.UNDEFINED when "guild_id" is not present in the passed payload for the payload of the integration.

UnrecognisedEntityError

If the command type is unknown.

deserialize_command_interaction #

deserialize_command_interaction(payload: JSONObject) -> CommandInteraction

Parse a raw payload from Discord into a command interaction object.

PARAMETER DESCRIPTION
payload

The JSON payload to deserialize.

TYPE: JSONObject

RETURNS DESCRIPTION
CommandInteraction

The deserialized command interaction object.

deserialize_component_interaction #

deserialize_component_interaction(payload: JSONObject) -> ComponentInteraction

Parser a raw payload from Discord into a component interaction object.

PARAMETER DESCRIPTION
payload

The JSON payload to deserialize.

TYPE: JSONObject

RETURNS DESCRIPTION
ComponentInteraction

The deserialized component interaction.

deserialize_context_menu_command #

deserialize_context_menu_command(payload: JSONObject, *, guild_id: UndefinedNoneOr[Snowflake] = undefined.UNDEFINED) -> ContextMenuCommand

Parse a raw payload from Discord into a context menu command object.

PARAMETER DESCRIPTION
payload

The JSON payload to deserialize.

TYPE: JSONObject

guild_id

The ID of the guild this command belongs to. If this is specified then this will be prioritised over "guild_id" in the payload.

TYPE: UndefinedNoneOr[Snowflake] DEFAULT: UNDEFINED

RETURNS DESCRIPTION
ContextMenuCommand

The deserialized context menu command object.

RAISES DESCRIPTION
KeyError

If guild_id is left as hikari.undefined.UNDEFINED when "guild_id" is not present in the passed payload for the payload of the integration.

deserialize_custom_emoji #

deserialize_custom_emoji(payload: JSONObject) -> CustomEmoji

Parse a raw payload from Discord into a custom emoji object.

PARAMETER DESCRIPTION
payload

The JSON payload to deserialize.

TYPE: JSONObject

RETURNS DESCRIPTION
CustomEmoji

The deserialized custom emoji object.

deserialize_dm #

deserialize_dm(payload: JSONObject) -> DMChannel

Parse a raw payload from Discord into a DM channel object.

PARAMETER DESCRIPTION
payload

The JSON payload to deserialize.

TYPE: JSONObject

RETURNS DESCRIPTION
DMChannel

The deserialized DM channel object.

deserialize_embed #

deserialize_embed(payload: JSONObject) -> Embed

Parse a raw payload from Discord into an embed object.

PARAMETER DESCRIPTION
payload

The JSON payload to deserialize.

TYPE: JSONObject

RETURNS DESCRIPTION
Embed

The deserialized embed object.

deserialize_emoji #

deserialize_emoji(payload: JSONObject) -> Union[UnicodeEmoji, CustomEmoji]

Parse a raw payload from Discord into an emoji object.

PARAMETER DESCRIPTION
payload

The JSON payload to deserialize.

TYPE: JSONObject

RETURNS DESCRIPTION
UnicodeEmoji or CustomEmoji

The deserialized custom or unicode emoji object.

deserialize_entitlement #

deserialize_entitlement(payload: JSONObject) -> Entitlement

Parse a raw payload from Discord into an entitlement object.

PARAMETER DESCRIPTION
payload

The JSON payload to deserialize.

TYPE: JSONObject

RETURNS DESCRIPTION
Entitlement

The deserialized entitlement object.

deserialize_gateway_bot_info #

deserialize_gateway_bot_info(payload: JSONObject) -> GatewayBotInfo

Parse a raw payload from Discord into a gateway bot object.

PARAMETER DESCRIPTION
payload

The JSON payload to deserialize.

TYPE: JSONObject

RETURNS DESCRIPTION
GatewayBotInfo

The deserialized gateway bot information object.

deserialize_gateway_guild #

deserialize_gateway_guild(payload: JSONObject, *, user_id: Snowflake) -> GatewayGuildDefinition

Parse a raw payload from Discord into a guild object.

PARAMETER DESCRIPTION
payload

The JSON payload to deserialize.

TYPE: JSONObject

user_id

The current user's ID.

TYPE: Snowflake

RETURNS DESCRIPTION
GatewayGuildDefinition

The deserialized guild object and the internal collections as maps of hikari.snowflakes.Snowflake mapping to hikari.channels.GuildChannel, hikari.guilds.Member, hikari.presences.MemberPresence, hikari.guilds.Role, hikari.emojis.KnownCustomEmoji, and hikari.stickers.GuildSticker. This is provided in several components to allow separate caching and linking between entities in various relational cache implementations internally.

deserialize_group_dm #

deserialize_group_dm(payload: JSONObject) -> GroupDMChannel

Parse a raw payload from Discord into a group DM channel object.

PARAMETER DESCRIPTION
payload

The JSON payload to deserialize.

TYPE: JSONObject

RETURNS DESCRIPTION
GroupDMChannel

The deserialized group DM object.

deserialize_guild_category #

deserialize_guild_category(payload: JSONObject, *, guild_id: UndefinedOr[Snowflake] = undefined.UNDEFINED) -> GuildCategory

Parse a raw payload from Discord into a guild category object.

PARAMETER DESCRIPTION
payload

The JSON payload to deserialize.

TYPE: JSONObject

guild_id

The ID of the guild this channel belongs to. If passed then this will be prioritised over "guild_id" in the payload.

This currently only covers the gateway GUILD_CREATE event, where it is not included in the channel's payload.

TYPE: UndefinedOr[Snowflake] DEFAULT: UNDEFINED

RETURNS DESCRIPTION
GuildCategory

The deserialized guild category object.

RAISES DESCRIPTION
KeyError

If guild_id is left as hikari.undefined.UNDEFINED when "guild_id" is not present in the passed payload.

deserialize_guild_command_permissions #

deserialize_guild_command_permissions(payload: JSONObject) -> GuildCommandPermissions

Parse a raw payload from Discord into guild command permissions object.

PARAMETER DESCRIPTION
payload

The JSON payload to deserialize.

TYPE: JSONObject

RETURNS DESCRIPTION
GuildCommandPermissions

The deserialized guild command permissions object.

deserialize_guild_forum_channel #

deserialize_guild_forum_channel(payload: JSONObject, *, guild_id: UndefinedOr[Snowflake] = undefined.UNDEFINED) -> GuildForumChannel

Parse a raw payload from Discord into a guild forum channel object.

PARAMETER DESCRIPTION
payload

The JSON payload to deserialize.

TYPE: JSONObject

guild_id

The ID of the guild this channel belongs to. If passed then this will be prioritised over "guild_id" in the payload.

This currently only covers the gateway GUILD_CREATE event, where it is not included in the channel's payload.

TYPE: UndefinedOr[Snowflake] DEFAULT: UNDEFINED

RETURNS DESCRIPTION
GuildForumChannel

The deserialized guild forum channel object.

RAISES DESCRIPTION
KeyError

If guild_id is left as hikari.undefined.UNDEFINED when "guild_id" is not present in the passed payload.

deserialize_guild_member_ban #

deserialize_guild_member_ban(payload: JSONObject) -> GuildBan

Parse a raw payload from Discord into a guild member ban object.

PARAMETER DESCRIPTION
payload

The JSON payload to deserialize.

TYPE: JSONObject

RETURNS DESCRIPTION
GuildBan

The deserialized guild member ban object.

deserialize_guild_news_channel #

deserialize_guild_news_channel(payload: JSONObject, *, guild_id: UndefinedOr[Snowflake] = undefined.UNDEFINED) -> GuildNewsChannel

Parse a raw payload from Discord into a guild news channel object.

PARAMETER DESCRIPTION
payload

The JSON payload to deserialize.

TYPE: JSONObject

guild_id

The ID of the guild this channel belongs to. If passed then this will be prioritised over "guild_id" in the payload.

This currently only covers the gateway GUILD_CREATE event, where it is not included in the channel's payload.

TYPE: UndefinedOr[Snowflake] DEFAULT: UNDEFINED

RETURNS DESCRIPTION
GuildNewsChannel

The deserialized guild news channel object.

RAISES DESCRIPTION
KeyError

If guild_id is left as hikari.undefined.UNDEFINED when "guild_id" is not present in the passed payload.

deserialize_guild_news_thread #

deserialize_guild_news_thread(payload: JSONObject, *, guild_id: UndefinedOr[Snowflake] = undefined.UNDEFINED, member: UndefinedNoneOr[ThreadMember] = undefined.UNDEFINED, user_id: UndefinedOr[Snowflake] = undefined.UNDEFINED) -> GuildNewsThread

Parse a raw payload from Discord into a guild news thread object.

PARAMETER DESCRIPTION
payload

The JSON payload to deserialize.

TYPE: JSONObject

guild_id

The ID of the guild this channel belongs to. This will be prioritised over "guild_id" in the payload when passed.

Note

guild_id currently only covers the gateway GUILD_CREATE event where "guild_id" is not included in the channel's payload.

TYPE: UndefinedOr[Snowflake] DEFAULT: UNDEFINED

member

The member object for the thread. If passed then this will be prioritised over "member" in the payload when passed.

TYPE: UndefinedNoneOr[ThreadMember] DEFAULT: UNDEFINED

RETURNS DESCRIPTION
GuildNewsThread

The deserialized guild news thread object.

RAISES DESCRIPTION
KeyError

If guild_id is left as hikari.undefined.UNDEFINED when "guild_id" is not present in the passed payload.

deserialize_guild_preview #

deserialize_guild_preview(payload: JSONObject) -> GuildPreview

Parse a raw payload from Discord into a guild preview object.

PARAMETER DESCRIPTION
payload

The JSON payload to deserialize.

TYPE: JSONObject

RETURNS DESCRIPTION
GuildPreview

The deserialized guild preview object.

deserialize_guild_private_thread #

deserialize_guild_private_thread(payload: JSONObject, *, guild_id: UndefinedOr[Snowflake] = undefined.UNDEFINED, member: UndefinedNoneOr[ThreadMember] = undefined.UNDEFINED, user_id: UndefinedOr[Snowflake] = undefined.UNDEFINED) -> GuildPrivateThread

Parse a raw payload from Discord into a guild private thread object.

PARAMETER DESCRIPTION
payload

The JSON payload to deserialize.

TYPE: JSONObject

guild_id

The ID of the guild this channel belongs to. This will be prioritised over "guild_id" in the payload when passed.

Note

guild_id currently only covers the gateway GUILD_CREATE event where "guild_id" is not included in the channel's payload.

TYPE: UndefinedOr[Snowflake] DEFAULT: UNDEFINED

member

The member object for the thread. If passed then this will be prioritised over "member" in the payload when passed.

TYPE: UndefinedNoneOr[ThreadMember] DEFAULT: UNDEFINED

RETURNS DESCRIPTION
GuildPrivateThread

The deserialized guild private thread object.

RAISES DESCRIPTION
KeyError

If guild_id is left as hikari.undefined.UNDEFINED when "guild_id" is not present in the passed payload.

deserialize_guild_public_thread #

deserialize_guild_public_thread(payload: JSONObject, *, guild_id: UndefinedOr[Snowflake] = undefined.UNDEFINED, member: UndefinedNoneOr[ThreadMember] = undefined.UNDEFINED, user_id: UndefinedOr[Snowflake] = undefined.UNDEFINED) -> GuildPublicThread

Parse a raw payload from Discord into a guild public thread object.

PARAMETER DESCRIPTION
payload

The JSON payload to deserialize.

TYPE: JSONObject

guild_id

The ID of the guild this channel belongs to. This will be prioritised over "guild_id" in the payload when passed.

Note

guild_id currently only covers the gateway GUILD_CREATE event where "guild_id" is not included in the channel's payload.

TYPE: UndefinedOr[Snowflake] DEFAULT: UNDEFINED

member

The member object for the thread. If passed then this will be prioritised over "member" in the payload when passed.

TYPE: UndefinedNoneOr[ThreadMember] DEFAULT: UNDEFINED

RETURNS DESCRIPTION
GuildPublicThread

The deserialized guild public thread object.

RAISES DESCRIPTION
KeyError

If guild_id is left as hikari.undefined.UNDEFINED when "guild_id" is not present in the passed payload.

deserialize_guild_stage_channel #

deserialize_guild_stage_channel(payload: JSONObject, *, guild_id: UndefinedOr[Snowflake] = undefined.UNDEFINED) -> GuildStageChannel

Parse a raw payload from Discord into a guild stage channel object.

PARAMETER DESCRIPTION
payload

The JSON payload to deserialize.

TYPE: JSONObject

guild_id

The ID of the guild this channel belongs to. If passed then this will be prioritised over "guild_id" in the payload.

This currently only covers the gateway GUILD_CREATE event, where it is not included in the channel's payload.

TYPE: UndefinedOr[Snowflake] DEFAULT: UNDEFINED

RETURNS DESCRIPTION
GuildStageChannel

The deserialized guild stage channel object.

RAISES DESCRIPTION
KeyError

If guild_id is left as hikari.undefined.UNDEFINED when "guild_id" is not present in the passed payload.

deserialize_guild_sticker #

deserialize_guild_sticker(payload: JSONObject) -> GuildSticker

Parse a raw payload from Discord into a guild sticker object.

PARAMETER DESCRIPTION
payload

The JSON payload to deserialize.

TYPE: JSONObject

RETURNS DESCRIPTION
GuildSticker

The deserialized guild sticker object.

deserialize_guild_text_channel #

deserialize_guild_text_channel(payload: JSONObject, *, guild_id: UndefinedOr[Snowflake] = undefined.UNDEFINED) -> GuildTextChannel

Parse a raw payload from Discord into a guild text channel object.

PARAMETER DESCRIPTION
payload

The JSON payload to deserialize.

TYPE: JSONObject

guild_id

The ID of the guild this channel belongs to. If passed then this will be prioritised over "guild_id" in the payload.

This currently only covers the gateway GUILD_CREATE event, where it is not included in the channel's payload.

TYPE: UndefinedOr[Snowflake] DEFAULT: UNDEFINED

RETURNS DESCRIPTION
GuildTextChannel

The deserialized guild text channel object.

RAISES DESCRIPTION
KeyError

If guild_id is left as hikari.undefined.UNDEFINED when "guild_id" is not present in the passed payload.

deserialize_guild_thread #

deserialize_guild_thread(payload: JSONObject, *, guild_id: UndefinedOr[Snowflake] = undefined.UNDEFINED, member: UndefinedNoneOr[ThreadMember] = undefined.UNDEFINED, user_id: UndefinedOr[Snowflake] = undefined.UNDEFINED) -> GuildThreadChannel

Parse a raw payload from Discord into a guild thread channel object.

PARAMETER DESCRIPTION
guild_id

The ID of the guild this channel belongs to. If passed then this will be prioritised over "guild_id" in the payload.

Note

guild_id currently only covers the gateway GUILD_CREATE event where "guild_id" is not included in the channel's payload.

TYPE: UndefinedOr[Snowflake] DEFAULT: UNDEFINED

member

The member object for the thread. If passed then this will be prioritised over "member" in the payload when passed.

TYPE: UndefinedNoneOr[ThreadMember] DEFAULT: UNDEFINED

RETURNS DESCRIPTION
GuildThreadChannel

The deserialized guild thread channel object.

RAISES DESCRIPTION
KeyError

If guild_id is left as hikari.undefined.UNDEFINED when "guild_id" is not present in the passed payload.

deserialize_guild_voice_channel #

deserialize_guild_voice_channel(payload: JSONObject, *, guild_id: UndefinedOr[Snowflake] = undefined.UNDEFINED) -> GuildVoiceChannel

Parse a raw payload from Discord into a guild voice channel object.

PARAMETER DESCRIPTION
payload

The JSON payload to deserialize.

TYPE: JSONObject

guild_id

The ID of the guild this channel belongs to. If passed then this will be prioritised over "guild_id" in the payload.

This currently only covers the gateway GUILD_CREATE event, where it is not included in the channel's payload.

TYPE: UndefinedOr[Snowflake] DEFAULT: UNDEFINED

RETURNS DESCRIPTION
GuildVoiceChannel

The deserialized guild voice channel object.

RAISES DESCRIPTION
KeyError

If guild_id is left as hikari.undefined.UNDEFINED when "guild_id" is not present in the passed payload.

deserialize_guild_widget #

deserialize_guild_widget(payload: JSONObject) -> GuildWidget

Parse a raw payload from Discord into a guild widget object.

PARAMETER DESCRIPTION
payload

The JSON payload to deserialize.

TYPE: JSONObject

RETURNS DESCRIPTION
GuildWidget

The deserialized guild widget object.

deserialize_implicit_token #

deserialize_implicit_token(query: Query) -> OAuth2ImplicitToken

Parse a query from Discord into an implicit token object.

PARAMETER DESCRIPTION
query

The query parameters to deserialize.

TYPE: Query

RETURNS DESCRIPTION
OAuth2ImplicitToken

The deserialized OAuth2 implicit token object.

deserialize_incoming_webhook #

deserialize_incoming_webhook(payload: JSONObject) -> IncomingWebhook

Parse a raw payload from Discord into a incoming webhook object.

PARAMETER DESCRIPTION
payload

The JSON payload to deserialize.

TYPE: JSONObject

RETURNS DESCRIPTION
IncomingWebhook

The parsed incoming webhook object.

deserialize_integration #

deserialize_integration(payload: JSONObject, *, guild_id: UndefinedOr[Snowflake] = undefined.UNDEFINED) -> Integration

Parse a raw payload from Discord into an integration object.

PARAMETER DESCRIPTION
payload

The JSON payload to deserialize.

TYPE: JSONObject

guild_id

The ID of the guild this integration belongs to. If this is specified then this will be prioritised over "guild_id" in the payload.

TYPE: UndefinedOr[Snowflake] DEFAULT: UNDEFINED

RETURNS DESCRIPTION
Integration

The deserialized integration object.

RAISES DESCRIPTION
KeyError

If guild_id is left as hikari.undefined.UNDEFINED when "guild_id" is not present in the passed payload for the payload of the integration.

deserialize_interaction #

deserialize_interaction(payload: JSONObject) -> PartialInteraction

Parse a raw payload from Discord into an interaction object.

Note

This isn't required to implement logic for deserializing PING interactions and if you want to unmarshal those hikari.api.entity_factory.EntityFactory.deserialize_partial_interaction should be compatible.

PARAMETER DESCRIPTION
payload

The JSON payload to deserialize.

TYPE: JSONObject

RETURNS DESCRIPTION
PartialInteraction

The deserialized interaction object.

RAISES DESCRIPTION
UnrecognisedEntityError

If the integration type is unknown.

deserialize_invite #

deserialize_invite(payload: JSONObject) -> Invite

Parse a raw payload from Discord into an invite object.

PARAMETER DESCRIPTION
payload

The JSON payload to deserialize.

TYPE: JSONObject

RETURNS DESCRIPTION
Invite

The deserialized invite object.

deserialize_invite_with_metadata #

deserialize_invite_with_metadata(payload: JSONObject) -> InviteWithMetadata

Parse a raw payload from Discord into a invite with metadata object.

PARAMETER DESCRIPTION
payload

The JSON payload to deserialize.

TYPE: JSONObject

RETURNS DESCRIPTION
InviteWithMetadata

The deserialized invite with metadata object.

deserialize_known_custom_emoji #

deserialize_known_custom_emoji(payload: JSONObject, *, guild_id: UndefinedOr[Snowflake] = undefined.UNDEFINED) -> KnownCustomEmoji

Parse a raw payload from Discord into a known custom emoji object.

PARAMETER DESCRIPTION
payload

The JSON payload to deserialize.

TYPE: JSONObject

guild_id

The ID of the guild this emoji belongs to. This is not necessary for application emojis.

This is used to ensure that the guild a known custom emoji belongs to is remembered by allowing for a context based artificial guild_id attribute.

TYPE: UndefinedOr[Snowflake] DEFAULT: UNDEFINED

RETURNS DESCRIPTION
KnownCustomEmoji

The deserialized "known custom emoji" object.

deserialize_member #

deserialize_member(payload: JSONObject, *, user: UndefinedOr[User] = undefined.UNDEFINED, guild_id: UndefinedOr[Snowflake] = undefined.UNDEFINED) -> Member

Parse a raw payload from Discord into a member object.

Note

guild_id covers cases such as the GUILD_CREATE gateway event and GET Guild Member where "guild_id" is not included in the returned payload.

PARAMETER DESCRIPTION
payload

The JSON payload to deserialize.

TYPE: JSONObject

user

The user to attach to this member, should only be passed in situations where "user" is not included in the payload.

TYPE: UndefinedOr[User] DEFAULT: UNDEFINED

guild_id

The ID of the guild this member belongs to. If this is specified then this will be prioritised over "guild_id" in the payload.

TYPE: UndefinedOr[Snowflake] DEFAULT: UNDEFINED

RETURNS DESCRIPTION
Member

The deserialized member object.

RAISES DESCRIPTION
KeyError

If guild_id is left as hikari.undefined.UNDEFINED when "guild_id" is not present in the passed payload.

deserialize_member_presence #

deserialize_member_presence(payload: JSONObject, *, guild_id: UndefinedOr[Snowflake] = undefined.UNDEFINED) -> MemberPresence

Parse a raw payload from Discord into a member presence object.

Note

At the time of writing, the only place where guild_id will be mandatory is when parsing presences sent in a GUILD_CREATE event from Discord, since the guild_id attribute in the payload will have been omitted for redundancy.

PARAMETER DESCRIPTION
payload

The JSON payload to deserialize.

TYPE: JSONObject

guild_id

The ID of the guild the presence belongs to. If this is specified then it is prioritised over guild_id in the payload.

TYPE: UndefinedOr[Snowflake] DEFAULT: UNDEFINED

RETURNS DESCRIPTION
MemberPresence

The deserialized member presence object.

RAISES DESCRIPTION
KeyError

If guild_id is left as hikari.undefined.UNDEFINED when "guild_id" is not present in the passed payload.

deserialize_message #

deserialize_message(payload: JSONObject) -> Message

Parse a raw payload from Discord into a message object.

PARAMETER DESCRIPTION
payload

The JSON payload to deserialize.

TYPE: JSONObject

RETURNS DESCRIPTION
Message

The deserialized message object.

deserialize_modal_interaction #

deserialize_modal_interaction(payload: JSONObject) -> ModalInteraction

Parse a raw payload from Discord into a modal interaction object.

PARAMETER DESCRIPTION
payload

The JSON payload to deserialize.

TYPE: JSONObject

RETURNS DESCRIPTION
ModalInteraction

The deserialized modal interaction object.

deserialize_my_user #

deserialize_my_user(payload: JSONObject) -> OwnUser

Parse a raw payload from Discord into a user object.

PARAMETER DESCRIPTION
payload

The JSON payload to deserialize.

TYPE: JSONObject

RETURNS DESCRIPTION
OwnUser

The deserialized user object.

deserialize_own_application_role_connection #

deserialize_own_application_role_connection(payload: JSONObject) -> OwnApplicationRoleConnection

Parse a raw payload from Discord into an own application role connection object.

PARAMETER DESCRIPTION
payload

The JSON payload to deserialize.

TYPE: JSONObject

RETURNS DESCRIPTION
OwnApplicationRoleConnection

The deserialized "own application role connection" object.

deserialize_own_connection #

deserialize_own_connection(payload: JSONObject) -> OwnConnection

Parse a raw payload from Discord into an own connection object.

PARAMETER DESCRIPTION
payload

The JSON payload to deserialize.

TYPE: JSONObject

RETURNS DESCRIPTION
OwnConnection

The deserialized "own connection" object.

deserialize_own_guild #

deserialize_own_guild(payload: JSONObject) -> OwnGuild

Parse a raw payload from Discord into an own guild object.

PARAMETER DESCRIPTION
payload

The JSON payload to deserialize.

TYPE: JSONObject

RETURNS DESCRIPTION
OwnGuild

The deserialized "own guild" object.

deserialize_partial_channel #

deserialize_partial_channel(payload: JSONObject) -> PartialChannel

Parse a raw payload from Discord into a partial channel object.

PARAMETER DESCRIPTION
payload

The JSON payload to deserialize.

TYPE: JSONObject

RETURNS DESCRIPTION
PartialChannel

The deserialized "partial channel" object.

deserialize_partial_integration #

deserialize_partial_integration(payload: JSONObject) -> PartialIntegration

Parse a raw payload from Discord into a partial integration object.

PARAMETER DESCRIPTION
payload

The JSON payload to deserialize.

TYPE: JSONObject

RETURNS DESCRIPTION
PartialIntegration

The deserialized partial integration object.

deserialize_partial_interaction #

deserialize_partial_interaction(payload: JSONObject) -> PartialInteraction

Parse a raw payload from Discord into a partial interaction object.

PARAMETER DESCRIPTION
payload

The JSON payload to deserialize.

TYPE: JSONObject

RETURNS DESCRIPTION
PartialInteraction

The deserialized partial interaction object.

deserialize_partial_message #

deserialize_partial_message(payload: JSONObject) -> PartialMessage

Parse a raw payload from Discord into a partial message object.

PARAMETER DESCRIPTION
payload

The JSON payload to deserialize.

TYPE: JSONObject

RETURNS DESCRIPTION
PartialMessage

The deserialized partial message object.

deserialize_partial_sticker #

deserialize_partial_sticker(payload: JSONObject) -> PartialSticker

Parse a raw payload from Discord into a partial sticker object.

PARAMETER DESCRIPTION
payload

The JSON payload to deserialize.

TYPE: JSONObject

RETURNS DESCRIPTION
PartialSticker

The deserialized partial sticker object.

deserialize_partial_token #

deserialize_partial_token(payload: JSONObject) -> PartialOAuth2Token

Parse a raw payload from Discord into a partial OAuth2 token object.

PARAMETER DESCRIPTION
payload

The JSON payload to deserialize.

TYPE: JSONObject

RETURNS DESCRIPTION
PartialOAuth2Token

The deserialized partial OAuth2 token object.

deserialize_permission_overwrite #

deserialize_permission_overwrite(payload: JSONObject) -> PermissionOverwrite

Parse a raw payload from Discord into a permission overwrite object.

PARAMETER DESCRIPTION
payload

The JSON payload to deserialize.

TYPE: JSONObject

RETURNS DESCRIPTION
PermissionOverwrite

The deserialized permission overwrite object.

deserialize_rest_guild #

deserialize_rest_guild(payload: JSONObject) -> RESTGuild

Parse a raw payload from Discord into a guild object.

PARAMETER DESCRIPTION
payload

The JSON payload to deserialize.

TYPE: JSONObject

RETURNS DESCRIPTION
RESTGuild

The deserialized guild object.

deserialize_role #

deserialize_role(payload: JSONObject, *, guild_id: Snowflake) -> Role

Parse a raw payload from Discord into a role object.

PARAMETER DESCRIPTION
payload

The JSON payload to deserialize.

TYPE: JSONObject

guild_id

The ID of the guild this role belongs to. This is used to ensure that the guild a role belongs to is remembered by allowing for a context based artificial guild_id attribute.

TYPE: Snowflake

RETURNS DESCRIPTION
Role

The deserialized role object.

deserialize_scheduled_event #

deserialize_scheduled_event(payload: JSONObject) -> ScheduledEvent

Parse a raw payload from Discord into a scheduled event object.

PARAMETER DESCRIPTION
payload

The JSON payload to deserialize.

TYPE: JSONObject

RETURNS DESCRIPTION
ScheduledEvent

The deserialized scheduled event object.

RAISES DESCRIPTION
UnrecognisedEntityError

If the scheduled event type is unknown.

deserialize_scheduled_event_user #

deserialize_scheduled_event_user(payload: JSONObject, *, guild_id: UndefinedOr[Snowflake] = undefined.UNDEFINED) -> ScheduledEventUser

Parse a raw payload from Discord into a scheduled event user object.

PARAMETER DESCRIPTION
payload

The JSON payload to deserialize.

TYPE: JSONObject

guild_id

The ID of the guild the user belongs to. If this is specified then it is prioritised over guild_id in the payload.

TYPE: UndefinedOr[Snowflake] DEFAULT: UNDEFINED

RETURNS DESCRIPTION
ScheduledEventUser

The deserialized scheduled event user object.

deserialize_scheduled_external_event #

deserialize_scheduled_external_event(payload: JSONObject) -> ScheduledExternalEvent

Parse a raw payload from Discord into a scheduled external event object.

PARAMETER DESCRIPTION
payload

The JSON payload to deserialize.

TYPE: JSONObject

RETURNS DESCRIPTION
ScheduledExternalEvent

The deserialized scheduled external event object.

deserialize_scheduled_stage_event #

deserialize_scheduled_stage_event(payload: JSONObject) -> ScheduledStageEvent

Parse a raw payload from Discord into a scheduled stage event object.

PARAMETER DESCRIPTION
payload

The JSON payload to deserialize.

TYPE: JSONObject

RETURNS DESCRIPTION
ScheduledStageEvent

The deserialized scheduled stage event object.

deserialize_scheduled_voice_event #

deserialize_scheduled_voice_event(payload: JSONObject) -> ScheduledVoiceEvent

Parse a raw payload from Discord into a scheduled voice event object.

PARAMETER DESCRIPTION
payload

The JSON payload to deserialize.

TYPE: JSONObject

RETURNS DESCRIPTION
ScheduledVoiceEvent

The deserialized scheduled voice event object.

deserialize_sku #

deserialize_sku(payload: JSONObject) -> SKU

Parse a raw payload from Discord into an SKU object.

PARAMETER DESCRIPTION
payload

The JSON payload to deserialize.

TYPE: JSONObject

RETURNS DESCRIPTION
SKU

The deserialized SKU object.

deserialize_slash_command #

deserialize_slash_command(payload: JSONObject, *, guild_id: UndefinedNoneOr[Snowflake] = undefined.UNDEFINED) -> SlashCommand

Parse a raw payload from Discord into a slash command object.

PARAMETER DESCRIPTION
payload

The JSON payload to deserialize.

TYPE: JSONObject

guild_id

The ID of the guild this command belongs to. If this is specified then this will be prioritised over "guild_id" in the payload.

TYPE: UndefinedNoneOr[Snowflake] DEFAULT: UNDEFINED

RETURNS DESCRIPTION
SlashCommand

The deserialized slash command object.

RAISES DESCRIPTION
KeyError

If guild_id is left as hikari.undefined.UNDEFINED when "guild_id" is not present in the passed payload for the payload of the integration.

deserialize_stage_instance #

deserialize_stage_instance(payload: JSONObject) -> StageInstance

Parse a raw payload from Discord into a guild stage instance object.

PARAMETER DESCRIPTION
payload

The JSON payload to deserialize.

TYPE: JSONObject

RETURNS DESCRIPTION
StageInstance

The deserialized stage instance object

deserialize_standard_sticker #

deserialize_standard_sticker(payload: JSONObject) -> StandardSticker

Parse a raw payload from Discord into a standard sticker object.

PARAMETER DESCRIPTION
payload

The JSON payload to deserialize.

TYPE: JSONObject

RETURNS DESCRIPTION
StandardSticker

The deserialized standard sticker object.

deserialize_sticker_pack #

deserialize_sticker_pack(payload: JSONObject) -> StickerPack

Parse a raw payload from Discord into a sticker pack object.

PARAMETER DESCRIPTION
payload

The JSON payload to deserialize.

TYPE: JSONObject

RETURNS DESCRIPTION
StickerPack

The deserialized sticker pack object.

deserialize_template #

deserialize_template(payload: JSONObject) -> Template

Parse a raw payload from Discord into a template object.

PARAMETER DESCRIPTION
payload

The JSON payload to deserialize.

TYPE: JSONObject

RETURNS DESCRIPTION
Template

The deserialized template object.

deserialize_thread_member #

deserialize_thread_member(payload: JSONObject, *, thread_id: UndefinedOr[Snowflake] = undefined.UNDEFINED, user_id: UndefinedOr[Snowflake] = undefined.UNDEFINED) -> ThreadMember

Parse a raw payload from Discord into a thread member object.

PARAMETER DESCRIPTION
payload

The JSON payload to deserialize.

TYPE: JSONObject

thread_id

ID of the thread this member belongs to. This will be prioritised over "id" in the payload when passed.

Note

thread_id currently only covers the gateway GUILD_CREATE event where the field are is included in the thread member's payload.

TYPE: UndefinedOr[Snowflake] DEFAULT: UNDEFINED

RETURNS DESCRIPTION
ThreadMember

The deserialized thread member object.

RAISES DESCRIPTION
KeyError

If thread_id is left as hikari.undefined.UNDEFINED when the relevant field isn't present in the passed payload.

deserialize_unicode_emoji #

deserialize_unicode_emoji(payload: JSONObject) -> UnicodeEmoji

Parse a raw payload from Discord into a unicode emoji object.

PARAMETER DESCRIPTION
payload

The JSON payload to deserialize.

TYPE: JSONObject

RETURNS DESCRIPTION
UnicodeEmoji

The deserialized unicode emoji object.

deserialize_user #

deserialize_user(payload: JSONObject) -> User

Parse a raw payload from Discord into a user object.

PARAMETER DESCRIPTION
payload

The JSON payload to deserialize.

TYPE: JSONObject

RETURNS DESCRIPTION
User

The deserialized user object.

deserialize_vanity_url #

deserialize_vanity_url(payload: JSONObject) -> VanityURL

Parse a raw payload from Discord into a vanity url object.

PARAMETER DESCRIPTION
payload

The JSON payload to deserialize.

TYPE: JSONObject

RETURNS DESCRIPTION
VanityURL

The deserialized vanity url object.

deserialize_voice_region #

deserialize_voice_region(payload: JSONObject) -> VoiceRegion

Parse a raw payload from Discord into a voice region object.

PARAMETER DESCRIPTION
payload

The JSON payload to deserialize.

TYPE: JSONObject

RETURNS DESCRIPTION
VoiceRegion

The deserialized voice region object.

deserialize_voice_state #

deserialize_voice_state(payload: JSONObject, *, guild_id: UndefinedOr[Snowflake] = undefined.UNDEFINED, member: UndefinedOr[Member] = undefined.UNDEFINED) -> VoiceState

Parse a raw payload from Discord into a voice state object.

Note

At the time of writing, GUILD_CREATE events are the only known place where neither guild_id nor member will be keys on the payload. In this case, you will need to provide the former parameters explicitly.

PARAMETER DESCRIPTION
payload

The JSON payload to deserialize.

TYPE: JSONObject

guild_id

The ID of the guild this voice state belongs to. If this is specified then this will be prioritised over "guild_id" in the payload.

TYPE: UndefinedOr[Snowflake] DEFAULT: UNDEFINED

member

The object of the member this voice state belongs to. If this is specified then this will be prioritised over "member" in the payload.

TYPE: UndefinedOr[Member] DEFAULT: UNDEFINED

RETURNS DESCRIPTION
VoiceState

The deserialized voice state object.

RAISES DESCRIPTION
KeyError

If guild_id is left as hikari.undefined.UNDEFINED when "guild_id" is not present in the passed payload for the payload of the voice state.

This will also be raised if no member data was passed in any acceptable place.

deserialize_webhook #

deserialize_webhook(payload: JSONObject) -> PartialWebhook

Parse a raw payload from Discord into a webhook object.

PARAMETER DESCRIPTION
payload

The JSON payload to deserialize.

TYPE: JSONObject

RETURNS DESCRIPTION
PartialWebhook

The deserialized webhook object.

RAISES DESCRIPTION
UnrecognisedEntityError

If the channel type is unknown.

deserialize_welcome_screen #

deserialize_welcome_screen(payload: JSONObject) -> WelcomeScreen

Parse a raw payload from Discord into a guild welcome screen object.

PARAMETER DESCRIPTION
payload

The JSON payload to deserialize.

TYPE: JSONObject

RETURNS DESCRIPTION
WelcomeScreen

The deserialized guild welcome screen object.

serialize_application_connection_metadata_record #

serialize_application_connection_metadata_record(record: ApplicationRoleConnectionMetadataRecord) -> JSONObject

Serialize an application connection metadata record object to a json serializable dict.

PARAMETER DESCRIPTION
record

The record object to serialize.

TYPE: ApplicationRoleConnectionMetadataRecord

RETURNS DESCRIPTION
JSONObject

The serialized representation of the record object.

serialize_command_option #

serialize_command_option(option: CommandOption) -> JSONObject

Serialize a command option object to a json serializable dict.

PARAMETER DESCRIPTION
option

The command option object to serialize.

TYPE: CommandOption

RETURNS DESCRIPTION
JSONObject

The serialized representation of the command option.

serialize_command_permission #

serialize_command_permission(permission: CommandPermission) -> JSONObject

Serialize a command permission object to a json serializable dict.

PARAMETER DESCRIPTION
permission

The command permission object to serialize.

TYPE: CommandPermission

RETURNS DESCRIPTION
JSONObject

The serialized representation of the command permission.

serialize_embed #

serialize_embed(embed: Embed) -> tuple[JSONObject, list[Resource[AsyncReader]]]

Serialize an embed object to a json serializable dict.

PARAMETER DESCRIPTION
embed

The embed object to serialize.

TYPE: Embed

RETURNS DESCRIPTION
Tuple[JSONObject, List[Resource]]

A tuple with two items in it. The first item will be the serialized embed representation. The second item will be a list of resources to upload with the embed.

serialize_forum_tag #

serialize_forum_tag(tag: ForumTag) -> JSONObject

Serialize a forum tag object to a json serializable dict.

PARAMETER DESCRIPTION
tag

The forum tag object to serialize.

TYPE: ForumTag

RETURNS DESCRIPTION
JSONObject

The serialized representation of the forum tag.

serialize_permission_overwrite #

serialize_permission_overwrite(overwrite: PermissionOverwrite) -> JSONObject

Serialize a permission overwrite object to a json serializable dict.

PARAMETER DESCRIPTION
overwrite

The permission overwrite object to serialize.

TYPE: PermissionOverwrite

RETURNS DESCRIPTION
JSONObject

The serialized representation of the permission overwrite.

serialize_welcome_channel #

serialize_welcome_channel(welcome_channel: WelcomeChannel) -> JSONObject

Serialize a welcome channel object to a json serializable dict.

PARAMETER DESCRIPTION
welcome_channel

The guild welcome channel object to serialize.

TYPE: WelcomeChannel

RETURNS DESCRIPTION
JSONObject

The serialized representation of the welcome channel.