Skip to content

Interaction Resource

Note

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


Interaction dataclass

Bases: DataModel

Represents a Discord Interaction object.

id: int instance-attribute

ID of the interaction.

token: str instance-attribute

Continuation token for responding to the interaction.

channel_id: int instance-attribute

ID of the channel where the interaction was sent.

application_id: int instance-attribute

ID of the application that owns the interaction.

app_permissions: int instance-attribute

Bitwise set of permissions pertaining to the location of the interaction.

member: MemberModel = None class-attribute instance-attribute

Guild member invoking the interaction.

locale: str = None class-attribute instance-attribute

Invoking user's locale.

guild_locale: str = None class-attribute instance-attribute

Locale of the guild the interaction was invoked (if invoked in a guild).

guild_id: Optional[int] = None class-attribute instance-attribute

ID of guild the interaction was invoked (if invoked in a guild).

guild: Optional[GuildModel] = None class-attribute instance-attribute

Partial guild object of the guild the interaction was invoked (if invoked in a guild).

channel: Optional[Channel] = None class-attribute instance-attribute

Partial channel object the interaction was invoked.

respond async

Create a message in response to an interaction.

Parameters:

  • message (str | MessageBuilder) –

    content as a string or from MessageBuilder

  • with_response (bool, default: False ) –

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

update async

Update a message in response to an interaction.

Parameters:

  • message (str | MessageBuilder) –

    content as a string or from MessageBuilder

respond_modal async

Create a modal in response to an interaction.

Parameters:

  • modal (ModalBuilder) –

    modal data


InteractionDataTypes

Interaction data types constants.

SLASH_COMMAND = 1 class-attribute instance-attribute

The interaction is a slash command.

USER_COMMAND = 2 class-attribute instance-attribute

The interaction is attached to a user.

MESSAGE_COMMAND = 3 class-attribute instance-attribute

The interaction is attached to a message.


InteractionCallbackTypes

Interaction callback types constants.

PONG = 1 class-attribute instance-attribute

Acknowledge a Ping.

CHANNEL_MESSAGE_WITH_SOURCE = 4 class-attribute instance-attribute

Respond to an interaction with a message.

DEFERRED_CHANNEL_MESSAGE_WITH_SOURCE = 5 class-attribute instance-attribute

Acknowledge an interaction and edit a response later. User sees a loading state.

DEFERRED_UPDATE_MESSAGE = 6 class-attribute instance-attribute

Acknowledge an interaction and edit the original message later. The user does NOT see a loading state. (Components only)

UPDATE_MESSAGE = 7 class-attribute instance-attribute

Edit the message in which the component was attached.

APPLICATION_COMMAND_AUTOCOMPLETE_RESULT = 8 class-attribute instance-attribute

Respond to an autocomplete interaction with suggested choices.

MODAL = 9 class-attribute instance-attribute

Respond to an interaction with a popup modal (not available for MODAL_SUBMIT and PING interactions).

LAUNCH_ACTIVITY = 12 class-attribute instance-attribute

Launch an activity associated with the app (Activities must be enabled).