hikari.interactions.modal_interactions
#
Models and enums used for Discord's Modals interaction flow.
ModalResponseTypesT module-attribute
#
ModalResponseTypesT = Literal[
MESSAGE_CREATE,
4,
DEFERRED_MESSAGE_CREATE,
5,
MESSAGE_UPDATE,
7,
DEFERRED_MESSAGE_UPDATE,
6,
]
Type-hint of the response types which are valid for a modal interaction.
The following types are valid for this:
ModalInteraction #
Bases: MessageResponseMixin[ModalResponseTypesT]
, PremiumResponseMixin
Represents a modal interaction on Discord.
components class-attribute
instance-attribute
#
components: Sequence[ModalActionRowComponent] = field(
eq=False, hash=False, repr=True
)
Components in the modal.
custom_id class-attribute
instance-attribute
#
The custom id of the modal.
message class-attribute
instance-attribute
#
The message whose component triggered the modal.
This will be None
if the modal was a response to a command.
build_deferred_response #
build_deferred_response() -> InteractionDeferredBuilder
Get a deferred message response builder for use in the REST server flow.
Note
For interactions received over the gateway hikari.interactions.modal_interactions.ModalInteraction.create_initial_response
should be used to set the interaction response message.
Note
Unlike hikari.api.special_endpoints.InteractionMessageBuilder
, the result of this call can be returned as is without any modifications being made to it.
RETURNS | DESCRIPTION |
---|---|
InteractionDeferredBuilder | Deferred interaction message response builder object. |
build_response #
build_response() -> InteractionMessageBuilder
Get a message response builder for use in the REST server flow.
Note
For interactions received over the gateway hikari.interactions.modal_interactions.ModalInteraction.create_initial_response
should be used to set the interaction response message.
Examples:
async def handle_modal_interaction(
interaction: ModalInteraction,
) -> InteractionMessageBuilder:
return (
interaction.build_response()
.add_embed(Embed(description="Hi there"))
.set_content("Konnichiwa")
)
RETURNS | DESCRIPTION |
---|---|
InteractionMessageBuilder | Interaction message response builder object. |
ModalInteractionMetadata #
Bases: PartialInteractionMetadata
The interaction metadata for a modal initiated message.
original_response_message_id class-attribute
instance-attribute
#
The ID of the original response message, present only on follow-up messages.
triggering_interaction_metadata class-attribute
instance-attribute
#
triggering_interaction_metadata: PartialInteractionMetadata = field(
eq=False, hash=False, repr=True
)
The metadata for the interaction that was used to open the modal.