ApplicationCommandContext

abstract class ApplicationCommandContext(val genericEvent: ApplicationCommandInteractionCreateEvent, val genericCommand: ApplicationCommand<*>, val cache: MutableStringKeyedMap<Any>) : CommandContext

Base class representing the shared functionality for an application command's context.

Parameters

genericEvent

Generic event object to populate data from.

genericCommand

Generic command object that this context belongs to.

Inheritors

Constructors

Link copied to clipboard
constructor(genericEvent: ApplicationCommandInteractionCreateEvent, genericCommand: ApplicationCommand<*>, cache: MutableStringKeyedMap<Any>)

Properties

Link copied to clipboard
val appPermissions: Permissions?

The permissions applicable to your bot in this execution context (guild, roles, channels), or null if this command wasn't executed on a guild.

Link copied to clipboard

Current bot setting object.

Link copied to clipboard
Link copied to clipboard
open lateinit var channel: MessageChannelBehavior

Channel this command was executed within.

Link copied to clipboard
open val command: Command
Link copied to clipboard
open val commandName: Key
Link copied to clipboard
open val eventObj: Event
Link copied to clipboard
Link copied to clipboard
val genericEvent: ApplicationCommandInteractionCreateEvent
Link copied to clipboard
open var guild: GuildBehavior?

Guild this command was executed within, if any.

Link copied to clipboard
open var member: MemberBehavior?

Member that executed this command, if on a guild.

Link copied to clipboard
open override var resolvedLocale: Locale?

Cached locale variable, stored and retrieved by getLocale.

Link copied to clipboard

Current Sentry context, containing breadcrumbs and other goodies.

Link copied to clipboard
open lateinit var user: UserBehavior

User that executed this command.

Functions

Link copied to clipboard
open suspend override fun getChannel(): MessageChannelBehavior

Extract channel information from event data, if that context is available.

Link copied to clipboard
open suspend override fun getGuild(): GuildBehavior?

Extract guild information from event data, if that context is available.

Link copied to clipboard
open override fun getKoin(): Koin

Get the associated Koin instance.

Link copied to clipboard
open suspend override fun getLocale(): Locale

Resolve the locale for this context, storing it in resolvedLocale.

Link copied to clipboard
open suspend override fun getMember(): MemberBehavior?

Extract member information from event data, if that context is available.

Link copied to clipboard
open suspend override fun getUser(): UserBehavior

Extract user information from event data, if that context is available.

Link copied to clipboard
open suspend override fun populate()

Called before processing, used to populate any extra variables from event data.

Link copied to clipboard
suspend fun CommandContext.waitForResponse(timeout: Long, filter: suspend MessageCreateEvent.() -> Boolean = { true }): Message?

Wait for a message by the user that invoked this command, in the channel it was invoked in, using the given timeout (in milliseconds) and extra filter function.