AutocompleteArg

open class AutocompleteArg<Input, Output>(val name: String, val description: String, val type: PrimitiveArgument<Input, Output>, autocomplete: suspend AutocompleteData.() -> List<Input>) : WrappedArgument<Input, Output, Input, Output>

Provides autocomplete options to slash input.

Constructors

Link copied to clipboard
constructor(name: String, description: String, type: PrimitiveArgument<Input, Output>, autocomplete: suspend AutocompleteData.() -> List<Input>)

Properties

Link copied to clipboard
open override val description: String

A description of the data that this type represents.

Link copied to clipboard

Get the innermost/raw type inside this argument.

Link copied to clipboard
open override val name: String

The display name for this type in documentations and examples.

Link copied to clipboard
open override val type: PrimitiveArgument<Input, Output>

The Argument that is wrapped.

Functions

Link copied to clipboard
inline fun <T> WrappedArgument<*, *, *, *>.containsType(): Boolean

Perform a nested search on this wrapped argument to check for a certain type.

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

Accept multiple inputs of this Argument.

Link copied to clipboard
open fun optional(default: Output): OptionalArg<Input, Output, Output>

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

open fun optional(default: suspend (DiscordContext) -> Output): OptionalArg<Input, Output, Output>

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

Link copied to clipboard

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

open fun optionalNullable(default: suspend (DiscordContext) -> Output?): OptionalArg<Input, Output, Output?>

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

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

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

Link copied to clipboard
open suspend fun transform(input: Input, context: DiscordContext): Result<Output>

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