Skip to content

Interaction Resource

Note

The following classes come from the scurrypy.resources.interaction module.


Interaction dataclass

Bases: BaseResource

Represents a Discord Interaction object.

id: int instance-attribute

ID of the interaction.

token: str instance-attribute

Continuation token for responding to the interaction.

context: Any instance-attribute

Associated user data.

respond async

Create a message in response to an interaction.

Parameters:

  • message (str | MessagePart) –

    content as a string or MessagePart

  • with_response (bool, default: False ) –

    if the interaction data should be returned. Defaults to False.

  • **flags (Unpack[MessageFlagParams], default: {} ) –

    message flags to set. (set respective flag to True to toggle.)

Raises:

  • TypeError

    invalid message type

Returns:

update async

Update a message in response to an interaction.

Parameters:

  • message (str | MessagePart) –

    content as a string or MessagePart

Raises:

  • TypeError

    invalid message type

respond_modal async

Create a modal in response to an interaction.

Parameters:

  • modal (ModalPart) –

    modal data

Raises:

  • TypeError

    invalid modal type

respond_autocomplete async

Autocomplete a command in response to an interaction.

Parameters:

  • choices (list[CommandOptionChoice]) –

    list of choices to autocomplete

defer_respond async

Defer creating a message in response to an interaction.

Parameters:

  • ephemeral (bool) –

    whether thinking + deferred interaction response is ephemeral

defer_update async

Defer updating a message in response to an interaction.

Parameters:

  • ephemeral (bool) –

    whether the deferred interaction response is ephemeral

followup async

Create a new message to respond to a deferred interaction.

Important

Apps are limited to 5 followup messages PER interaction.

Parameters:

  • application_id (int) –

    ID of the application

  • message (str | MessagePart) –

    content as a string or MessagePart

  • **flags (Unpack[MessageFlagParams], default: {} ) –

    message flags to set. (set respective flag to True to toggle.)

Raises:

  • TypeError

    invalid message type

edit_original async

Update the original interaction response from a deferred update interaction.

Parameters:

  • application_id (int) –

    ID of the application

  • message (str | MessagePart) –

    content as a string or MessagePart

Raises:

  • TypeError

    invalid message type