arg

fun <T : Any> CommandContext.arg(index: Int, type: KClass<T>): T

Extension function for CommandContext that retrieves and parses the argument at the specified index.

The argument is parsed according to the provided type. If the argument is missing or cannot be parsed, an error message is thrown.

Return

The parsed argument of type T.

Parameters

index

The index of the argument to retrieve.

type

The type of the argument to parse.

Throws

If the argument is missing or cannot be parsed.


inline fun <T : Any> CommandContext.arg(index: Int): T

Inline extension function for CommandContext that retrieves and parses the argument at the specified index.

This function infers the type T from the reified type argument.

Return

The parsed argument of type T.

Parameters

index

The index of the argument to retrieve.

Throws

If the argument is missing or cannot be parsed.