hikari.api.entity_factory#
Core interface for an object that serializes/deserializes API objects.
Module Contents#
- class hikari.api.entity_factory.GatewayGuildDefinition[source]#
Bases:
abc.ABC
Structure for handling entities within guild create and update events.
Warning
The methods on this class may raise
LookupError
if called when the relevant resource isn’t available in the inner payload.- abstract property id: hikari.snowflakes.Snowflake[source]#
ID of the guild the definition is for.
- abstract members()[source]#
Get a mapping of user IDs to the members that belong to the guild.
Note
This may be a partial mapping of members in the guild.
- abstract presences()[source]#
Get a mapping of user IDs to the presences that are active in the guild.
Note
This may be a partial mapping of presences active in the guild.
- class hikari.api.entity_factory.EntityFactory[source]#
Bases:
abc.ABC
Interface for components that serialize and deserialize JSON payloads.
- abstract deserialize_own_connection(payload)[source]#
Parse a raw payload from Discord into an own connection object.
- Parameters
- payload
hikari.internal.data_binding.JSONObject
The JSON payload to deserialize.
- payload
- Returns
hikari.applications.OwnConnection
The deserialized “own connection” object.
- abstract deserialize_own_guild(payload)[source]#
Parse a raw payload from Discord into an own guild object.
- Parameters
- payload
hikari.internal.data_binding.JSONObject
The JSON payload to deserialize.
- payload
- Returns
hikari.applications.OwnGuild
The deserialized “own guild” object.
- abstract deserialize_application(payload)[source]#
Parse a raw payload from Discord into an application object.
- Parameters
- payload
hikari.internal.data_binding.JSONObject
The JSON payload to deserialize.
- payload
- Returns
hikari.applications.Application
The deserialized application object.
- abstract deserialize_authorization_information(payload)[source]#
Parse a raw payload from Discord into an authorization information object.
- Parameters
- payload
hikari.internal.data_binding.JSONObject
The JSON payload to deserialize.
- payload
- Returns
hikari.applications.AuthorizationInformation
The deserialized authorization information object.
- abstract deserialize_partial_token(payload)[source]#
Parse a raw payload from Discord into a partial OAuth2 token object.
- Parameters
- payload
hikari.internal.data_binding.JSONObject
The JSON payload to deserialize.
- payload
- Returns
hikari.applications.PartialOAuth2Token
The deserialized partial OAuth2 token object.
- abstract deserialize_authorization_token(payload)[source]#
Parse a raw payload from Discord into an authorization token object.
- Parameters
- payload
hikari.internal.data_binding.JSONObject
The JSON payload to deserialize.
- payload
- Returns
hikari.applications.OAuth2AuthorizationToken
The deserialized OAuth2 authorization token object.
- abstract deserialize_implicit_token(query)[source]#
Parse a query from Discord into an implicit token object.
- Parameters
- query
hikari.internal.data_binding.Query
The query parameters to deserialize.
- query
- Returns
hikari.applications.OAuth2ImplicitToken
The deserialized OAuth2 implicit token object.
- abstract deserialize_audit_log(payload)[source]#
Parse a raw payload from Discord into an audit log object.
- Parameters
- payload
hikari.internal.data_binding.JSONObject
The JSON payload to deserialize.
- payload
- Returns
hikari.audit_logs.AuditLog
The deserialized audit log object.
- abstract deserialize_channel_follow(payload)[source]#
Parse a raw payload from Discord into a channel follow object.
- Parameters
- payload
hikari.internal.data_binding.JSONObject
The JSON payload to deserialize.
- payload
- Returns
hikari.channels.ChannelFollow
The deserialized channel follow object.
- abstract deserialize_permission_overwrite(payload)[source]#
Parse a raw payload from Discord into a permission overwrite object.
- Parameters
- payload
hikari.internal.data_binding.JSONObject
The JSON payload to deserialize.
- payload
- Returns
hikari.channels.PermissionOverwrite
The deserialized permission overwrite object.
- abstract serialize_permission_overwrite(overwrite)[source]#
Serialize a permission overwrite object to a json serializable dict.
- Parameters
- overwrite
hikari.channels.PermissionOverwrite
The permission overwrite object to serialize.
- overwrite
- Returns
hikari.internal.data_binding.JSONObject
The serialized representation of the permission overwrite.
- abstract deserialize_partial_channel(payload)[source]#
Parse a raw payload from Discord into a partial channel object.
- Parameters
- payload
hikari.internal.data_binding.JSONObject
The JSON payload to deserialize.
- payload
- Returns
hikari.channels.PartialChannel
The deserialized “partial channel” object.
- abstract deserialize_dm(payload)[source]#
Parse a raw payload from Discord into a DM channel object.
- Parameters
- payload
hikari.internal.data_binding.JSONObject
The JSON payload to deserialize.
- payload
- Returns
hikari.channels.DMChannel
The deserialized DM channel object.
- abstract deserialize_group_dm(payload)[source]#
Parse a raw payload from Discord into a group DM channel object.
- Parameters
- payload
hikari.internal.data_binding.JSONObject
The JSON payload to deserialize.
- payload
- Returns
hikari.channels.GroupDMChannel
The deserialized group DM object.
- abstract deserialize_guild_category(payload, *, guild_id=undefined.UNDEFINED)[source]#
Parse a raw payload from Discord into a guild category object.
- Parameters
- payload
hikari.internal.data_binding.JSONObject
The JSON payload to deserialize.
- payload
- Other Parameters
- guild_id
hikari.undefined.UndefinedOr
[hikari.snowflakes.Snowflake
] 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.
- guild_id
- Returns
hikari.channels.GuildCategory
The deserialized guild category object.
- Raises
KeyError
If
guild_id
is left ashikari.undefined.UNDEFINED
when"guild_id"
is not present in the passed payload.
- abstract deserialize_guild_text_channel(payload, *, guild_id=undefined.UNDEFINED)[source]#
Parse a raw payload from Discord into a guild text channel object.
- Parameters
- payload
hikari.internal.data_binding.JSONObject
The JSON payload to deserialize.
- payload
- Other Parameters
- guild_id
hikari.undefined.UndefinedOr
[hikari.snowflakes.Snowflake
] 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.
- guild_id
- Returns
hikari.channels.GuildTextChannel
The deserialized guild text channel object.
- Raises
KeyError
If
guild_id
is left ashikari.undefined.UNDEFINED
when"guild_id"
is not present in the passed payload.
- abstract deserialize_guild_news_channel(payload, *, guild_id=undefined.UNDEFINED)[source]#
Parse a raw payload from Discord into a guild news channel object.
- Parameters
- payload
hikari.internal.data_binding.JSONObject
The JSON payload to deserialize.
- payload
- Other Parameters
- guild_id
hikari.snowflakes.Snowflake
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.
- guild_id
- Returns
hikari.channels.GuildNewsChannel
The deserialized guild news channel object.
- Raises
KeyError
If
guild_id
is left ashikari.undefined.UNDEFINED
when"guild_id"
is not present in the passed payload.
- abstract deserialize_guild_voice_channel(payload, *, guild_id=undefined.UNDEFINED)[source]#
Parse a raw payload from Discord into a guild voice channel object.
- Parameters
- payload
hikari.internal.data_binding.JSONObject
The JSON payload to deserialize.
- payload
- Other Parameters
- guild_id
hikari.snowflakes.Snowflake
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.
- guild_id
- Returns
hikari.channels.GuildVoiceChannel
The deserialized guild voice channel object.
- Raises
KeyError
If
guild_id
is left ashikari.undefined.UNDEFINED
when"guild_id"
is not present in the passed payload.
- abstract deserialize_guild_stage_channel(payload, *, guild_id=undefined.UNDEFINED)[source]#
Parse a raw payload from Discord into a guild stage channel object.
- Parameters
- payload
hikari.internal.data_binding.JSONObject
The JSON payload to deserialize.
- payload
- Other Parameters
- guild_id
hikari.snowflakes.Snowflake
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.
- guild_id
- Returns
hikari.channels.GuildStageChannel
The deserialized guild stage channel object.
- Raises
KeyError
If
guild_id
is left ashikari.undefined.UNDEFINED
when"guild_id"
is not present in the passed payload.
- abstract deserialize_thread_member(payload, *, thread_id=undefined.UNDEFINED)[source]#
Parse a raw payload from Discord into a thread member object.
- Parameters
- payload
hikari.internal.data_binding.JSONObject
The JSON payload to deserialize.
- payload
- Other Parameters
- thread_id
hikari.undefined.UndefinedOr
[hikari.snowflakes.Snowflake
] 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.
- thread_id
- Returns
hikari.channels.ThreadMember
The deserialized thread member object.
- Raises
KeyError
If
thread_id
oruser_id
is left ashikari.undefined.UNDEFINED
when the relevant field isn’t present in the passed payload.
- abstract deserialize_guild_thread(payload, *, guild_id=undefined.UNDEFINED, member=undefined.UNDEFINED)[source]#
Parse a raw payload from Discord into a guild thread channel object.
- Parameters
- guild_id
hikari.undefined.UndefinedOr
[hikari.snowflakes.Snowflake
] 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.- member
hikari.undefined.UndefinedNoneOr
[hikari.channels.ThreadMember
] The member object for the thread. If passed then this will be prioritised over
"member"
in the payload when passed.
- guild_id
- Returns
hikari.channels.GuildThreadChannel
The deserialized guild thread channel object.
- Raises
KeyError
If
guild_id
is left ashikari.undefined.UNDEFINED
when"guild_id"
is not present in the passed payload.
- abstract deserialize_guild_news_thread(payload, *, guild_id=undefined.UNDEFINED, member=undefined.UNDEFINED)[source]#
Parse a raw payload from Discord into a guild news thread object.
- Parameters
- payload
hikari.internal.data_binding.JSONObject
The JSON payload to deserialize.
- payload
- Other Parameters
- guild_id
hikari.undefined.UndefinedOr
[hikari.snowflakes.Snowflake
] 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.- member
hikari.undefined.UndefinedNoneOr
[hikari.channels.ThreadMember
] The member object for the thread. If passed then this will be prioritised over
"member"
in the payload when passed.
- guild_id
- Returns
hikari.channels.GuildNewsThread
The deserialized guild news thread object.
- Raises
KeyError
If
guild_id
is left ashikari.undefined.UNDEFINED
when"guild_id"
is not present in the passed payload.
- abstract deserialize_guild_public_thread(payload, *, guild_id=undefined.UNDEFINED, member=undefined.UNDEFINED)[source]#
Parse a raw payload from Discord into a guild public thread object.
- Parameters
- payload
hikari.internal.data_binding.JSONObject
The JSON payload to deserialize.
- payload
- Other Parameters
- guild_id
hikari.undefined.UndefinedOr
[hikari.snowflakes.Snowflake
] 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.- member
hikari.undefined.UndefinedNoneOr
[hikari.channels.ThreadMember
] The member object for the thread. If passed then this will be prioritised over
"member"
in the payload when passed.
- guild_id
- Returns
hikari.channels.GuildPublicThread
The deserialized guild public thread object.
- Raises
KeyError
If
guild_id
is left ashikari.undefined.UNDEFINED
when"guild_id"
is not present in the passed payload.
- abstract deserialize_guild_private_thread(payload, *, guild_id=undefined.UNDEFINED, member=undefined.UNDEFINED)[source]#
Parse a raw payload from Discord into a guild private thread object.
- Parameters
- payload
hikari.internal.data_binding.JSONObject
The JSON payload to deserialize.
- payload
- Other Parameters
- guild_id
hikari.undefined.UndefinedOr
[hikari.snowflakes.Snowflake
] 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.- member
hikari.undefined.UndefinedNoneOr
[hikari.channels.ThreadMember
] The member object for the thread. If passed then this will be prioritised over
"member"
in the payload when passed.
- guild_id
- Returns
hikari.channels.GuildPrivateThread
The deserialized guild private thread object.
- Raises
KeyError
If
guild_id
is left ashikari.undefined.UNDEFINED
when"guild_id"
is not present in the passed payload.
- abstract deserialize_channel(payload, *, guild_id=undefined.UNDEFINED)[source]#
Parse a raw payload from Discord into a channel object.
Note
This also deserializes to thread channels.
- Parameters
- payload
hikari.internal.data_binding.JSONObject
The JSON payload to deserialize.
- payload
- Other Parameters
- guild_id
hikari.undefined.UndefinedOr
[hikari.snowflakes.Snowflake
] 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
- guild_id
- Returns
hikari.channels.PartialChannel
The deserialized partial channel-derived object.
- Raises
KeyError
If
guild_id
is left ashikari.undefined.UNDEFINED
when"guild_id"
is not present in the passed payload of a guild channel.hikari.errors.UnrecognisedEntityError
If the channel type is unknown.
- abstract deserialize_embed(payload)[source]#
Parse a raw payload from Discord into an embed object.
- Parameters
- payload
hikari.internal.data_binding.JSONObject
The JSON payload to deserialize.
- payload
- Returns
hikari.embeds.Embed
The deserialized embed object.
- abstract serialize_embed(embed)[source]#
Serialize an embed object to a json serializable dict.
- Parameters
- embed
hikari.embeds.Embed
The embed object to serialize.
- embed
- Returns
typing.Tuple
[hikari.internal.data_binding.JSONObject
,typing.List
[hikari.files.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.
- abstract deserialize_unicode_emoji(payload)[source]#
Parse a raw payload from Discord into a unicode emoji object.
- Parameters
- payload
hikari.internal.data_binding.JSONObject
The JSON payload to deserialize.
- payload
- Returns
hikari.emojis.UnicodeEmoji
The deserialized unicode emoji object.
- abstract deserialize_custom_emoji(payload)[source]#
Parse a raw payload from Discord into a custom emoji object.
- Parameters
- payload
hikari.internal.data_binding.JSONObject
The JSON payload to deserialize.
- payload
- Returns
hikari.emojis.CustomEmoji
The deserialized custom emoji object.
- abstract deserialize_known_custom_emoji(payload, *, guild_id)[source]#
Parse a raw payload from Discord into a known custom emoji object.
- Parameters
- payload
hikari.internal.data_binding.JSONObject
The JSON payload to deserialize.
- guild_id
hikari.snowflakes.Snowflake
The ID of the guild this emoji belongs to. 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.
- payload
- Returns
hikari.emojis.KnownCustomEmoji
The deserialized “known custom emoji” object.
- abstract deserialize_emoji(payload)[source]#
Parse a raw payload from Discord into an emoji object.
- Parameters
- payload
hikari.internal.data_binding.JSONObject
The JSON payload to deserialize.
- payload
- Returns
hikari.emojis.UnicodeEmoji
orhikari.emojis.CustomEmoji
The deserialized custom or unicode emoji object.
- abstract deserialize_gateway_bot_info(payload)[source]#
Parse a raw payload from Discord into a gateway bot object.
- Parameters
- payload
hikari.internal.data_binding.JSONObject
The JSON payload to deserialize.
- payload
- Returns
hikari.sessions.GatewayBotInfo
The deserialized gateway bot information object.
- abstract deserialize_guild_widget(payload)[source]#
Parse a raw payload from Discord into a guild widget object.
- Parameters
- payload
hikari.internal.data_binding.JSONObject
The JSON payload to deserialize.
- payload
- Returns
hikari.guilds.GuildWidget
The deserialized guild widget object.
- abstract deserialize_welcome_screen(payload)[source]#
Parse a raw payload from Discord into a guild welcome screen object.
- Parameters
- payload
hikari.internal.data_binding.JSONObject
The JSON payload to deserialize.
- payload
- Returns
hikari.guilds.WelcomeScreen
The deserialized guild welcome screen object.
- abstract serialize_welcome_channel(welcome_channel)[source]#
Serialize a welcome channel object to a json serializable dict.
- Parameters
- welcome_channel
hikari.guilds.WelcomeChannel
The guild welcome channel object to serialize.
- welcome_channel
- Returns
hikari.internal.data_binding.JSONObject
The serialized representation of the welcome channel.
- abstract deserialize_member(payload, *, user=undefined.UNDEFINED, guild_id=undefined.UNDEFINED)[source]#
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.- Parameters
- payload
hikari.internal.data_binding.JSONObject
The JSON payload to deserialize.
- payload
- Other Parameters
- user
hikari.undefined.UndefinedOr
[hikari.users.User
] The user to attach to this member, should only be passed in situations where “user” is not included in the payload.
- guild_id
hikari.undefined.UndefinedOr
[hikari.snowflakes.Snowflake
] The ID of the guild this member belongs to. If this is specified then this will be prioritised over
"guild_id"
in the payload.
- user
- Returns
hikari.guilds.Member
The deserialized member object.
- Raises
KeyError
If
guild_id
is left ashikari.undefined.UNDEFINED
when"guild_id"
is not present in the passed payload.
- abstract deserialize_role(payload, *, guild_id)[source]#
Parse a raw payload from Discord into a role object.
- Parameters
- payload
hikari.internal.data_binding.JSONObject
The JSON payload to deserialize.
- guild_id
hikari.snowflakes.Snowflake
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.
- payload
- Returns
hikari.guilds.Role
The deserialized role object.
- abstract deserialize_partial_integration(payload)[source]#
Parse a raw payload from Discord into a partial integration object.
- Parameters
- payload
hikari.internal.data_binding.JSONObject
The JSON payload to deserialize.
- payload
- Returns
hikari.guilds.PartialIntegration
The deserialized partial integration object.
- abstract deserialize_integration(payload, *, guild_id=undefined.UNDEFINED)[source]#
Parse a raw payload from Discord into an integration object.
- Parameters
- payload
hikari.internal.data_binding.JSONObject
The JSON payload to deserialize.
- payload
- Other Parameters
- guild_id
hikari.undefined.UndefinedOr
[hikari.snowflakes.Snowflake
] The ID of the guild this integration belongs to. If this is specified then this will be prioritised over
"guild_id"
in the payload.
- guild_id
- Returns
hikari.guilds.Integration
The deserialized integration object.
- Raises
KeyError
If
guild_id
is left ashikari.undefined.UNDEFINED
when"guild_id"
is not present in the passed payload for the payload of the integration.
- abstract deserialize_guild_member_ban(payload)[source]#
Parse a raw payload from Discord into a guild member ban object.
- Parameters
- payload
hikari.internal.data_binding.JSONObject
The JSON payload to deserialize.
- payload
- Returns
hikari.guilds.GuildBan
The deserialized guild member ban object.
- abstract deserialize_guild_preview(payload)[source]#
Parse a raw payload from Discord into a guild preview object.
- Parameters
- payload
hikari.internal.data_binding.JSONObject
The JSON payload to deserialize.
- payload
- Returns
hikari.guilds.GuildPreview
The deserialized guild preview object.
- abstract deserialize_rest_guild(payload)[source]#
Parse a raw payload from Discord into a guild object.
- Parameters
- payload
hikari.internal.data_binding.JSONObject
The JSON payload to deserialize.
- payload
- Returns
hikari.guilds.RESTGuild
The deserialized guild object.
- abstract deserialize_gateway_guild(payload, *, user_id)[source]#
Parse a raw payload from Discord into a guild object.
- Parameters
- payload
hikari.internal.data_binding.JSONObject
The JSON payload to deserialize.
- user_id
hikari.snowflakes.Snowflake
The current user’s ID.
- payload
- Returns
GatewayGuildDefinition
The deserialized guild object and the internal collections as maps of
hikari.snowflakes.Snowflake
mapping tohikari.channels.GuildChannel
,hikari.guilds.Member
,hikari.presences.MemberPresence
,hikari.guilds.Role
,hikari.emojis.KnownCustomEmoji
, andhikari.stickers.GuildSticker
. This is provided in several components to allow separate caching and linking between entities in various relational cache implementations internally.
- abstract deserialize_slash_command(payload, *, guild_id=undefined.UNDEFINED)[source]#
Parse a raw payload from Discord into a slash command object.
- Parameters
- payload
hikari.internal.data_binding.JSONObject
The JSON payload to deserialize.
- payload
- Other Parameters
- guild_id
hikari.undefined.UndefinedNoneOr
[hikari.snowflakes.Snowflake
] The ID of the guild this command belongs to. If this is specified then this will be prioritised over
"guild_id"
in the payload.
- guild_id
- Returns
hikari.commands.SlashCommand
The deserialized slash command object.
- Raises
KeyError
If
guild_id
is left ashikari.undefined.UNDEFINED
when"guild_id"
is not present in the passed payload for the payload of the integration.
Parse a raw payload from Discord into a context menu command object.
- Parameters
- payload
hikari.internal.data_binding.JSONObject
The JSON payload to deserialize.
- payload
- Other Parameters
- guild_id
hikari.undefined.UndefinedNoneOr
[hikari.snowflakes.Snowflake
] The ID of the guild this command belongs to. If this is specified then this will be prioritised over
"guild_id"
in the payload.
- guild_id
- Returns
hikari.commands.ContextMenuCommand
The deserialized context menu command object.
- Raises
KeyError
If
guild_id
is left ashikari.undefined.UNDEFINED
when"guild_id"
is not present in the passed payload for the payload of the integration.
- abstract deserialize_command(payload, *, guild_id=undefined.UNDEFINED)[source]#
Parse a raw payload from Discord into a command object.
- Parameters
- payload
hikari.internal.data_binding.JSONObject
The JSON payload to deserialize.
- payload
- Other Parameters
- guild_id
hikari.undefined.UndefinedNoneOr
[hikari.snowflakes.Snowflake
] The ID of the guild this command belongs to. If this is specified then this will be prioritised over
"guild_id"
in the payload.
- guild_id
- Returns
hikari.commands.PartialCommand
The deserialized command object.
- Raises
KeyError
If
guild_id
is left ashikari.undefined.UNDEFINED
when"guild_id"
is not present in the passed payload for the payload of the integration.hikari.errors.UnrecognisedEntityError
If the command type is unknown.
- abstract deserialize_guild_command_permissions(payload)[source]#
Parse a raw payload from Discord into guild command permissions object.
- Parameters
- payload
hikari.internal.data_binding.JSONObject
The JSON payload to deserialize.
- payload
- Returns
hikari.commands.GuildCommandPermissions
The deserialized guild command permissions object.
- abstract serialize_command_permission(permission)[source]#
Serialize a command permission object to a json serializable dict.
- Parameters
- permission
hikari.commands.CommandPermission
The command permission object to serialize.
- permission
- Returns
hikari.internal.data_binding.JSONObject
The serialized representation of the command permission.
- abstract deserialize_partial_interaction(payload)[source]#
Parse a raw payload from Discord into a partial interaction object.
- Parameters
- payload
hikari.internal.data_binding.JSONObject
The JSON payload to deserialize.
- payload
- Returns
hikari.interactions.base_interactions.PartialInteraction
The deserialized partial interaction object.
- abstract deserialize_command_interaction(payload)[source]#
Parse a raw payload from Discord into a command interaction object.
- Parameters
- payload
hikari.internal.data_binding.JSONObject
The JSON payload to deserialize.
- payload
- Returns
hikari.interactions.command_interactions.CommandInteraction
The deserialized command interaction object.
- abstract deserialize_autocomplete_interaction(payload)[source]#
Parse a raw payload from Discord into an autocomplete interaction object.
- Parameters
- payload
hikari.internal.data_binding.JSONObject
The JSON payload to deserialize.
- payload
- Returns
hikari.interactions.command_interactions.AutocompleteInteraction
The deserialized autocomplete interaction object.
- abstract deserialize_modal_interaction(payload)[source]#
Parse a raw payload from Discord into a modal interaction object.
- Parameters
- payload
hikari.internal.data_binding.JSONObject
The JSON payload to deserialize.
- payload
- Returns
hikari.interactions.modal_interactions.ModalInteraction
The deserialized modal interaction object.
- abstract deserialize_interaction(payload)[source]#
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
EntityFactory.deserialize_partial_interaction
should be compatible.- Parameters
- payload
hikari.internal.data_binding.JSONObject
The JSON payload to deserialize.
- payload
- Returns
hikari.interactions.base_interactions.PartialInteraction
The deserialized interaction object.
- Raises
hikari.errors.UnrecognisedEntityError
If the integration type is unknown.
- abstract serialize_command_option(option)[source]#
Serialize a command option object to a json serializable dict.
- Parameters
- option
hikari.commands.CommandOption
The command option object to serialize.
- option
- Returns
hikari.internal.data_binding.JSONObject
The serialized representation of the command option.
- abstract deserialize_component_interaction(payload)[source]#
Parser a raw payload from Discord into a component interaction object.
- Parameters
- payload
hikari.internal.data_binding.JSONObject
The JSON payload to deserialize.
- payload
- Returns
hikari.interactions.component_interactions.ComponentInteraction
The deserialized component interaction.
- abstract deserialize_vanity_url(payload)[source]#
Parse a raw payload from Discord into a vanity url object.
- Parameters
- payload
hikari.internal.data_binding.JSONObject
The JSON payload to deserialize.
- payload
- Returns
hikari.invites.VanityURL
The deserialized vanity url object.
- abstract deserialize_invite(payload)[source]#
Parse a raw payload from Discord into an invite object.
- Parameters
- payload
hikari.internal.data_binding.JSONObject
The JSON payload to deserialize.
- payload
- Returns
hikari.invites.Invite
The deserialized invite object.
- abstract deserialize_invite_with_metadata(payload)[source]#
Parse a raw payload from Discord into a invite with metadata object.
- Parameters
- payload
hikari.internal.data_binding.JSONObject
The JSON payload to deserialize.
- payload
- Returns
hikari.invites.InviteWithMetadata
The deserialized invite with metadata object.
- abstract deserialize_sticker_pack(payload)[source]#
Parse a raw payload from Discord into a sticker pack object.
- Parameters
- payload
hikari.internal.data_binding.JSONObject
The JSON payload to deserialize.
- payload
- Returns
hikari.stickers.StickerPack
The deserialized sticker pack object.
- abstract deserialize_partial_sticker(payload)[source]#
Parse a raw payload from Discord into a partial sticker object.
- Parameters
- payload
hikari.internal.data_binding.JSONObject
The JSON payload to deserialize.
- payload
- Returns
hikari.stickers.PartialSticker
The deserialized partial sticker object.
- abstract deserialize_standard_sticker(payload)[source]#
Parse a raw payload from Discord into a standard sticker object.
- Parameters
- payload
hikari.internal.data_binding.JSONObject
The JSON payload to deserialize.
- payload
- Returns
hikari.stickers.StandardSticker
The deserialized standard sticker object.
- abstract deserialize_guild_sticker(payload)[source]#
Parse a raw payload from Discord into a guild sticker object.
- Parameters
- payload
hikari.internal.data_binding.JSONObject
The JSON payload to deserialize.
- payload
- Returns
hikari.stickers.GuildSticker
The deserialized guild sticker object.
- abstract deserialize_partial_message(payload)[source]#
Parse a raw payload from Discord into a partial message object.
- Parameters
- payload
hikari.internal.data_binding.JSONObject
The JSON payload to deserialize.
- payload
- Returns
hikari.messages.PartialMessage
The deserialized partial message object.
- abstract deserialize_message(payload)[source]#
Parse a raw payload from Discord into a message object.
- Parameters
- payload
hikari.internal.data_binding.JSONObject
The JSON payload to deserialize.
- payload
- Returns
hikari.messages.Message
The deserialized message object.
- abstract deserialize_member_presence(payload, *, guild_id=undefined.UNDEFINED)[source]#
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 aGUILD_CREATE
event from Discord, since theguild_id
attribute in the payload will have been omitted for redundancy.- Parameters
- payload
hikari.internal.data_binding.JSONObject
The JSON payload to deserialize.
- payload
- Other Parameters
- guild_id
hikari.undefined.UndefinedOr
[hikari.snowflakes.Snowflake
] The ID of the guild the presence belongs to. If this is specified then it is prioritised over
guild_id
in the payload.
- guild_id
- Returns
hikari.presences.MemberPresence
The deserialized member presence object.
- Raises
KeyError
If
guild_id
is not an attribute of thepayload
dict, and no guild ID was passed for theguild_id
parameter.If this is raised, no guild ID info was provided anywhere.
- abstract deserialize_scheduled_external_event(payload)[source]#
Parse a raw payload from Discord into a scheduled external event object.
- Parameters
- payload
hikari.internal.data_binding.JSONObject
The JSON payload to deserialize.
- payload
- Returns
hikari.scheduled_events.ScheduledExternalEvent
The deserialized scheduled external event object.
- abstract deserialize_scheduled_stage_event(payload)[source]#
Parse a raw payload from Discord into a scheduled stage event object.
- Parameters
- payload
hikari.internal.data_binding.JSONObject
The JSON payload to deserialize.
- payload
- Returns
hikari.scheduled_events.ScheduledStageEvent
The deserialized scheduled stage event object.
- abstract deserialize_scheduled_voice_event(payload)[source]#
Parse a raw payload from Discord into a scheduled voice event object.
- Parameters
- payload
hikari.internal.data_binding.JSONObject
The JSON payload to deserialize.
- payload
- Returns
hikari.scheduled_events.ScheduledVoiceEvent
The deserialized scheduled voice event object.
- abstract deserialize_scheduled_event(payload)[source]#
Parse a raw payload from Discord into a scheduled event object.
- Parameters
- payload
hikari.internal.data_binding.JSONObject
The JSON payload to deserialize.
- payload
- Returns
hikari.scheduled_events.ScheduledEvent
The deserialized scheduled event object.
- Raises
hikari.errors.UnrecognisedEntityError
If the scheduled event type is unknown.
- abstract deserialize_scheduled_event_user(payload, *, guild_id=undefined.UNDEFINED)[source]#
Parse a raw payload from Discord into a scheduled event user object.
- Parameters
- payload
hikari.internal.data_binding.JSONObject
The JSON payload to deserialize.
- payload
- Other Parameters
- guild_id
hikari.undefined.UndefinedOr
[hikari.snowflakes.Snowflake
] The ID of the guild the user belongs to. If this is specified then it is prioritised over
guild_id
in the payload.
- guild_id
- Returns
hikari.scheduled_events.ScheduledEventUser
The deserialized scheduled event user object.
- abstract deserialize_template(payload)[source]#
Parse a raw payload from Discord into a template object.
- Parameters
- payload
hikari.internal.data_binding.JSONObject
The JSON payload to deserialize.
- payload
- Returns
hikari.templates.Template
The deserialized template object.
- abstract deserialize_user(payload)[source]#
Parse a raw payload from Discord into a user object.
- Parameters
- payload
hikari.internal.data_binding.JSONObject
The JSON payload to deserialize.
- payload
- Returns
hikari.users.User
The deserialized user object.
- abstract deserialize_my_user(payload)[source]#
Parse a raw payload from Discord into a user object.
- Parameters
- payload
hikari.internal.data_binding.JSONObject
The JSON payload to deserialize.
- payload
- Returns
hikari.users.OwnUser
The deserialized user object.
- abstract deserialize_voice_state(payload, *, guild_id=undefined.UNDEFINED, member=undefined.UNDEFINED)[source]#
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 neitherguild_id
normember
will be keys on the payload. In this case, you will need to provide the former parameters explicitly.- Parameters
- payload
hikari.internal.data_binding.JSONObject
The JSON payload to deserialize.
- payload
- Other Parameters
- guild_id
hikari.undefined.UndefinedOr
[hikari.snowflakes.Snowflake
] 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.- member
hikari.undefined.UndefinedOr
[hikari.guilds.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.
- guild_id
- Returns
hikari.voices.VoiceState
The deserialized voice state object.
- Raises
KeyError
If
guild_id
is left ashikari.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.
- abstract deserialize_voice_region(payload)[source]#
Parse a raw payload from Discord into a voice region object.
- Parameters
- payload
hikari.internal.data_binding.JSONObject
The JSON payload to deserialize.
- payload
- Returns
hikari.voices.VoiceRegion
The deserialized voice region object.
- abstract deserialize_incoming_webhook(payload)[source]#
Parse a raw payload from Discord into a incoming webhook object.
- Parameters
- payload
hikari.internal.data_binding.JSONObject
The JSON payload to deserialize.
- payload
- Returns
hikari.webhooks.IncomingWebhook
The parsed incoming webhook object.
- abstract deserialize_channel_follower_webhook(payload)[source]#
Parse a raw payload from Discord into a channel follower webhook object.
- Parameters
- payload
hikari.internal.data_binding.JSONObject
The JSON payload to deserialize.
- payload
- Returns
hikari.webhooks.ChannelFollowerWebhook
The parsed channel follower webhook object.
- abstract deserialize_application_webhook(payload)[source]#
Parse a raw payload from Discord into an application webhook object.
- Parameters
- payload
hikari.internal.data_binding.JSONObject
The JSON payload to deserialize.
- payload
- Returns
hikari.webhooks.ApplicationWebhook
The parsed application webhook object.
- abstract deserialize_webhook(payload)[source]#
Parse a raw payload from Discord into a webhook object.
- Parameters
- payload
hikari.internal.data_binding.JSONObject
The JSON payload to deserialize.
- payload
- Returns
hikari.webhooks.PartialWebhook
The deserialized webhook object.
- Raises
hikari.errors.UnrecognisedEntityError
If the channel type is unknown.