SlashContext API Reference#
The SlashContext class provided to each .SlashCommand callback.
SlashContext#
- class dawn.SlashContext(bot: Bot, event: hikari.InteractionCreateEvent)[source]#
This object wraps the
hikari.InteractionCreateEvent
class for more easy to access the class’ methods and attributes.- Parameters
bot (
Bot
) – The related bot class.event (
hikari.InteractionCreateEvent
) – The event to get context for.
- property author: hikari.users.User | hikari.interactions.base_interactions.InteractionMember | None#
An alias to SlashContext.member or SlashContext.user.
- property channel: hikari.channels.GuildChannel | None#
The
hikari.GuildChannel
object where the command was invoked.
- property channel_id: Snowflake#
ID of the channel where command was invoked.
- property command: t.Optional['SlashCommand']#
The
SlashCommand
this SlashContext belongs to.
- async create_response(content: Union[T, UndefinedType] = UNDEFINED, **options) None [source]#
Create a response for the
SlashCommand
interaction.Paramaters are same as
hikari.CommandInteraction.create_initial_response
- async defer() None [source]#
Defers the response. This is useful if the command process is time taking or the response has to be created later.
- async edit_response(content: Union[T, UndefinedType] = UNDEFINED, **options) None [source]#
Edit the response sent for the
SlashCommand
interaction.Paramaters are same as
hikari.CommandInteraction.create_initial_response
- property event: InteractionCreateEvent#
The event this SlashContext was derived from.
- property interaction: CommandInteraction#
The interaction related to this SlashContext.
- property member: hikari.interactions.base_interactions.InteractionMember | None#
hikari.InteractionMember
object of thehikari.User
who invoked the slash command, if applicable.
- property user: User#
hikari.User
who invoked the slash command.
- property user_id: Snowflake#
ID of command author.