ContextCommand

class ContextCommand(    val name: String,     val displayText: String,     var description: String,     val category: String,     var requiredPermissions: Permissions,     val executions: MutableList<Execution<CommandEvent<*>>> = mutableListOf()) : GuildSlashCommand

A command that can be executed via the context menu.

Constructors

Link copied to clipboard
fun ContextCommand(    name: String,     displayText: String,     description: String,     category: String,     requiredPermissions: Permissions,     executions: MutableList<Execution<CommandEvent<*>>> = mutableListOf())

Functions

Link copied to clipboard
open fun <T : CommandEvent<*>> addExecution(argTypes: List<Argument<*, *>>, execute: suspend T.() -> Unit)

Add an Execution to this Command. Called automatically by each execute block. You should not need to call this manually.

Link copied to clipboard
open suspend fun canParse(    context: DiscordContext,     execution: Execution<*>,     args: List<String>): Boolean

Whether the command can parse the given arguments into a container.

Link copied to clipboard
open suspend fun hasPermissionToRun(    discord: Discord,     author: User,     guild: Guild?): Boolean

Whether this command has permission to run with the given event.

Link copied to clipboard
open fun invoke(event: CommandEvent<TypeContainer>, args: List<String>)

Invoke this command with the given args.

Properties

Link copied to clipboard
open override val category: String

The category that this command belongs to - set automatically by CommandSet.

Link copied to clipboard
open override var description: String

A brief description of the command - used in documentation.

Link copied to clipboard
val displayText: String

The text shown in the context menu.

Link copied to clipboard
open val execution: Execution<CommandEvent<*>>

The single execution of slash command.

Link copied to clipboard
open override val executions: MutableList<Execution<CommandEvent<*>>>

The list of Execution that this command can be run with.

Link copied to clipboard
open override val name: String

The name of the slash command.

Link copied to clipboard
open val names: List<String>

All names (aliases) of this command.

Link copied to clipboard
open override var requiredPermissions: Permissions

The permission level required to use this command.