CommandArg

open class CommandArg(val name: String = "Command", val description: String = internalLocale.commandArgDescription) : StringArgument<Command>

Accepts a DiscordKt command by name.

Constructors

Link copied to clipboard
fun CommandArg(name: String = "Command", description: String = internalLocale.commandArgDescription)

Types

Link copied to clipboard
object Companion : CommandArg

Accepts a DiscordKt command by name.

Functions

Link copied to clipboard
open fun autocomplete(choices: suspend AutocompleteData.() -> List<String>): AutocompleteArg<String, Command>

Offer autocomplete options for this argument.

Link copied to clipboard
open suspend override fun generateExamples(context: DiscordContext): List<String>

A function called whenever an example of this type is needed.

Link copied to clipboard
open fun isOptional(): Boolean

Utility function to check that this Argument is an OptionalArg.

Link copied to clipboard
open fun multiple(): MultipleArg<String, Command>

Accept multiple inputs of this Argument.

Link copied to clipboard
open fun optional(default: suspend (DiscordContext) -> Command): OptionalArg<String, Command, Command>

Make this argument optional and fall back to the default value if the conversion fails. Exposes a CommandEvent.

open fun optional(default: Command): OptionalArg<String, Command, Command>

Make this argument optional and fall back to the default value if the conversion fails.

Link copied to clipboard
open fun optionalNullable(default: suspend (DiscordContext) -> Command?): OptionalArg<String, Command, Command?>

Make this argument optional and fall back to the default value if the conversion fails. Exposes a CommandEvent.

open fun optionalNullable(default: Command? = null): OptionalArg<String, Command, Command?>

Make this argument optional and fall back to the default value if the conversion fails.

Link copied to clipboard
open suspend override fun parse(args: MutableList<String>, discord: Discord): String?

Parse string input into the correct type handled by this argument.

Link copied to clipboard
open suspend override fun transform(input: String, context: DiscordContext): Result<Command>

Transforms a value produced by a slash command or by the parse function.

Properties

Link copied to clipboard
open override val description: String

A description of the data that this type represents.

Link copied to clipboard
open override val name: String

The display name for this type in documentations and examples.

Inheritors

Link copied to clipboard