CommandContext

open class CommandContext

Context passed to command executors

Constructors

Link copied to clipboard
constructor(args: Map<String, out Any>, _this: WidgetChatInput$configureSendListeners$2, _args: Array<Any>, messageContent: MessageContent)

Types

Link copied to clipboard
Looks like Discord's required args are unreliable and are sometimes accepted even if empty.

Functions

Link copied to clipboard
open fun addAttachment(attachment: LocalAttachment)
open fun addAttachment(attachment: Attachment<out Any>)
open fun addAttachment(uri: String, displayName: String)
Adds an attachment
Link copied to clipboard
open fun containsArg(key: String): Boolean
Check if the arguments contain the specified key
Link copied to clipboard
open fun get(key: String): Any
Gets the raw argument with the specified key
Link copied to clipboard
open fun getBool(key: String): Boolean
Gets the Boolean argument with the specified key
Link copied to clipboard
open fun getBoolOrDefault(key: String, defaultValue: Boolean): Boolean
Gets the Boolean argument with the specified key or the defaultValue if no such argument is present
Link copied to clipboard
Returns the current channel
Gets the Channel argument with the specified key
Link copied to clipboard
open fun getChannelId(): Long
Returns the current channel id
Link copied to clipboard
Gets the channel argument with the specified key or the defaultValue if no such argument is present
Link copied to clipboard
open fun getContext(): Context
Returns the AppContext
Link copied to clipboard
Returns the current channel
Link copied to clipboard
open fun getInt(key: String): Integer
Gets the Integer argument with the specified key
Link copied to clipboard
open fun getIntOrDefault(key: String, defaultValue: Int): Int
Gets the Integer argument with the specified key or the defaultValue if no such argument is present
Link copied to clipboard
open fun getLong(key: String): Long
Gets the Long argument with the specified key
Link copied to clipboard
open fun getLongOrDefault(key: String, defaultValue: Long): Long
Gets the Long argument with the specified key or the defaultValue if no such argument is present
Link copied to clipboard
open fun getMaxFileSizeMB(): Int
Returns the maximum size attachments may be
Link copied to clipboard
open fun getMe(): MeUser
Returns the current user
Link copied to clipboard
open fun getMentionedUsers(): List<User>
Returns the mentioned users
Link copied to clipboard
open fun getMessageReference(): MessageReference
Returns the MessageReference
Link copied to clipboard
open fun getOrDefault(key: String, defaultValue: Any): Any
Gets the raw argument with the specified key or the defaultValue if no such argument is present
Link copied to clipboard
open fun getRawArgs(): Map<String, out Any>
Returns the raw args
Link copied to clipboard
open fun getRawContent(): String
Returns the raw content of the message that invoked this command
Link copied to clipboard
open fun getReferencedMessage(): Message
Returns the referenced message
Link copied to clipboard
Returns the Author of the referenced message
Link copied to clipboard
Returns the Author of the referenced message as member of the current guild
Link copied to clipboard
Returns the link of the referenced message
Link copied to clipboard
open fun getReplyingState(): ChatInputViewModel.ViewState.Loaded.PendingReplyState.Replying
Link copied to clipboard
open fun getRequired(key: String): Any
Gets the required raw argument with the specified key
Link copied to clipboard
Gets the required Boolean argument with the specified key
Link copied to clipboard
Gets the required channel argument with the specified key
Link copied to clipboard
open fun getRequiredInt(key: String): Int
Gets the required Integer argument with the specified key
Link copied to clipboard
open fun getRequiredLong(key: String): Long
Gets the required Long argument with the specified key
Link copied to clipboard
Gets the required Role argument with the specified key
Link copied to clipboard
Gets the required String argument with the specified key
Link copied to clipboard
Gets the arguments object for the specified subcommand
Link copied to clipboard
open fun getRequiredUser(key: String): User
Gets the required User argument with the specified key
Link copied to clipboard
Gets the Role argument with the specified key
Link copied to clipboard
Gets the Role argument with the specified key or the defaultValue if no such argument is present
Link copied to clipboard
Gets the String argument with the specified key
Link copied to clipboard
open fun getStringOrDefault(key: String, @NonNull defaultValue: String): String
Gets the String argument with the specified key or the defaultValue if no such argument is present
Link copied to clipboard
Gets the arguments object for the specified subcommand
Link copied to clipboard
open fun getUser(key: String): User
Gets the User argument with the specified key
Link copied to clipboard
open fun getUserOrDefault(key: String, defaultValue: User): User
Gets the User argument with the specified key or the defaultValue if no such argument is present
Link copied to clipboard
open fun setChannelId(id: Long)
Sets the current channel id

Properties

Link copied to clipboard
@get:NonNull
open val attachments: List<Attachment<out Any>>
Link copied to clipboard
@get:NonNull
val viewState: ChatInputViewModel.ViewState.Loaded