Skip to content

Context

AutocompleteContext #

Represents an autocomplete interaction context.

Attributes:

InteractionContext #

Represents an interaction context.

arguments class-attribute instance-attribute #
arguments: Dict[str, Any] = attrs.field(factory=dict, eq=False)

Arguments to the interaction.

Note

Available only for commands.

bot class-attribute instance-attribute #
bot: GatewayBotAware = attrs.field(eq=False, repr=False)

The instance of the bot.

channel property #
channel: PartialChannel | None

Channel of the interaction.

client class-attribute instance-attribute #
client: Client = attrs.field(eq=False, repr=False)

The client.

command class-attribute instance-attribute #
command: AppCommand | None = attrs.field(eq=False, default=None, repr=False)

Command of interaction.

Note

Available only for commands.

guild property #
guild: GatewayGuild | None

Guild of the interaction.

interaction class-attribute instance-attribute #
interaction: CommandInteraction | ComponentInteraction = attrs.field(eq=False)

The interaction of context.

locale class-attribute instance-attribute #
locale: Any = attrs.field(eq=False)

An any locale object for the interaction.

member property #
member: InteractionMember | None

Member of the interaction.

user property #

User of the interaction.

create_response async #
create_response(content: UndefinedOr[Any] = UNDEFINED, *, flags: MessageFlag = MessageFlag.NONE, ephemeral: bool = False, attachment: UndefinedOr[Resourceish] = UNDEFINED, attachments: UndefinedOr[Sequence[Resourceish]] = UNDEFINED, component: UndefinedOr[ComponentBuilder] = UNDEFINED, components: UndefinedOr[Sequence[ComponentBuilder]] = UNDEFINED, embed: UndefinedOr[Embed] = UNDEFINED, embeds: UndefinedOr[Sequence[Embed]] = UNDEFINED, mentions_everyone: UndefinedOr[bool] = UNDEFINED, user_mentions: UndefinedOr[SnowflakeishSequence[PartialUser] | bool] = UNDEFINED, role_mentions: UndefinedOr[SnowflakeishSequence[PartialRole] | bool] = UNDEFINED) -> None

Create a response to the interaction.

Note
  • If the interaction appears and is not deferred, it will be available for the next three seconds. After that, it will no longer be available. If your callback takes more than 3 seconds, please use InteractionContext.defer to delay the response.
  • If the interaction already has a response: default, deferred, you has to InteractionContext or you'll catch a error Interaction was already acknowledged from Discord API.

Parameters:

defer async #
defer(flags: MessageFlag = MessageFlag.NONE, *, ephemeral: bool = False) -> None

Create a deferred response to the interaction.

Note

The interaction will be available in the next 15 minutes.

Parameters:

  • flags (MessageFlag, default: MessageFlag.NONE ) –

    An optional flags for response.

  • ephemeral (bool, default: False ) –

    An optional flag to create ephemeral response. Ephemeral messages that only the author of the interaction can see. They are similar to Clyde's messages.

delete_response async #
delete_response() -> None

Delete the interaction's response.

edit_response async #
edit_response(content: UndefinedOr[Any] = UNDEFINED, *, attachment: UndefinedOr[Resourceish] = UNDEFINED, attachments: UndefinedOr[Sequence[Resourceish]] = UNDEFINED, component: UndefinedOr[ComponentBuilder] = UNDEFINED, components: UndefinedOr[Sequence[ComponentBuilder]] = UNDEFINED, embed: UndefinedOr[Embed] = UNDEFINED, embeds: UndefinedOr[Sequence[Embed]] = UNDEFINED) -> Message | None

Edit the response of the interaction.

Parameters: