argOrNull

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

Extension function for CommandContext that retrieves and parses the argument at the specified index, or returns null if the argument is missing.

Return

The parsed argument of type T or null if the argument is missing.

Parameters

index

The index of the argument to retrieve.

type

The type of the argument to parse.


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

Inline extension function for CommandContext that retrieves and parses the argument at the specified index, or returns null if the argument is missing.

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

Return

The parsed argument of type T or null if the argument is missing.

Parameters

index

The index of the argument to retrieve.