discord-interactions.py

respond_to_interaction

Coroutinemust be awaited

Initial interaction response. With update=True, edits the message of the clicked component.

from discord_interactions import respond_to_interaction

Signature

async def respond_to_interaction(    interaction: discord.Interaction,    content: str | None = None,    embed: discord.Embed | None = None,    embeds: List[discord.Embed] | None = None,    components: Dict[str, Any] | Any | Sequence[Dict[str, Any] | Any] | None = None,    allowed_mentions: Dict[str, Any] | discord.AllowedMentions | None = None,    ephemeral: bool = False,    update: bool = False,    flags: int | None = None,    files: Sequence[discord.File] | None = None,    with_response: bool = False,    **kwargs: Any,) -> Any

Parameters

NameTypeDefaultDescription
interactiondiscord.InteractionrequiredInteraction to answer (within 3 seconds).
contentstr | NoneNone
embeddiscord.Embed | NoneNone
embedsList[discord.Embed] | NoneNone
componentsDict[str, Any] | Any | Sequence[Dict[str, Any] | Any] | NoneNone
allowed_mentionsDict[str, Any] | discord.AllowedMentions | NoneNone
ephemeralboolFalseVisible to the author only.
updateboolFalseEdit the original message instead of sending a new one.
flagsint | NoneNone
filesSequence[discord.File] | NoneNone
with_responseboolFalseReturn Discord's response object.
**kwargsAny

Returns

Any

Example

from discord_interactions import respond_to_interaction await respond_to_interaction(interaction, "Enregistré", ephemeral=True)await respond_to_interaction(interaction, components=[nouvelle_carte], update=True)

Type a name: create_button, ModalBuilder, cooldown.