Skip to content

command argument_type

Stjepan Bakrac edited this page May 22, 2020 · 4 revisions

This object represents a type definition for a command handler argument.

Fields

check function

Function to check the argument given to it by the raw command handler. Gets called with the raw string and the argument's options as parameters. Returns the parsed value.

count number or string

Tells the raw command handler how many arguments to consume to make this type. Accepts a number or '*' as parameters.

generate_args function

Called when generating the syntax for an argument. Called with the argument's options as parameter and returns the argument type's option parameters as a comma-separated string.

generate function

Called when generating the syntax for an argument. Called with the argument's options as parameter and returns the argument type's name.

name string

The name of the type.

pack function

Called after the arguments for this type have been parsed. Receives all parsed arguments for this type in an array.

parse_options function

The function to parse an options definition. Called by command.arg.parse with the comma-separated values inside the parentheses passed in as arguments.

For example, if the type definition is <foo:integer(3,7)> then the function would be called as argument.parse_options(3, 7).

Clone this wiki locally