Context
AutocompleteContext
#
Represents an autocomplete interaction context.
Attributes:
-
interaction(AutocompleteInteraction) –The interaction of context.
-
bot(GatewayBotAware) –The instance of the bot.
-
client(Client) –The client.
-
locale(Any) –An any locale object for the interaction.
InteractionContext
#
Represents an interaction context.
arguments
class-attribute
instance-attribute
#
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.
client
class-attribute
instance-attribute
#
client: Client = attrs.field(eq=False, repr=False)
The client.
command
class-attribute
instance-attribute
#
Command of interaction.
Note
Available only for commands.
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.
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.deferto delay the response. - If the interaction already has a response: default, deferred, you has to
InteractionContextor you'll catch a errorInteraction was already acknowledgedfrom Discord API.
Parameters:
-
content(Any, default:UNDEFINED) –The content of response.
-
flags(MessageFlag, default:MessageFlag.NONE) –An optional flags of 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.
-
attachment(Resourceish, default:UNDEFINED) –A single attachment of response.
-
attachments(Sequence[Resourceish], default:UNDEFINED) –A list of attachments of response.
-
component(ComponentBuilder, default:UNDEFINED) –A single component builder of response.
-
components(Sequence[ComponentBuilder], default:UNDEFINED) –A list of component builders of response.
-
embed(Embed, default:UNDEFINED) –A single embed of response.
-
embeds(Sequence[Embed], default:UNDEFINED) –A list of embeds of response.
-
mentions_everyone(bool, default:UNDEFINED) –Allows
@everyoneand@hereto ping users if set toTrue. -
user_mentions(UndefinedOr[SnowflakeishSequence[PartialUser] | bool], default:UNDEFINED) –- Allows to ping users is set to
True. - A list of users that can be pinged in response.
- Allows to ping users is set to
-
role_mentions(UndefinedOr[SnowflakeishSequence[PartialRole] | bool], default:UNDEFINED) –- Allows to ping roles is set to
True. - A list of roles that can be pinged in response.
- Allows to ping roles is set to
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.
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:
-
content(Any, default:UNDEFINED) –The content of response.
-
attachment(Resourceish, default:UNDEFINED) –A single attachment of response.
-
attachments(Sequence[Resourceish], default:UNDEFINED) –A list of attachments of response.
-
component(ComponentBuilder, default:UNDEFINED) –A single component builder of response.
-
components(Sequence[ComponentBuilder], default:UNDEFINED) –A list of component builders of response.
-
embed(Embed, default:UNDEFINED) –A single embed of response.
-
embeds(Sequence[Embed], default:UNDEFINED) –A list of embeds of response.