ContextCommand

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

A command that can be executed via the context menu.

Constructors

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

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 val description: String

A brief description of the command - used in documentation.

Link copied to clipboard

The text shown in the context menu.

Link copied to clipboard

The single execution of slash command.

Link copied to clipboard

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 val requiredPermissions: Permissions

The permission level required to use this command.

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.

Link copied to clipboard
suspend fun Command.mentionOrNull(guild: Guild): String?

Create a discord mention for this command.

suspend fun GuildSlashCommand.mentionOrNull(guild: Guild): String?

Create a discord mention for this guild slash command.