Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( TypeString = &command.BaseType{Name: "string"} TypeInt = &command.BaseType{Name: "int"} TypeBool = &command.BaseType{Name: "bool"} )
View Source
var ParameterBool = &command.ParameterType{ BaseType: TypeBool, Name: "bool", Parser: func(ctx *command.Context, index int, args []string) (any, error) { b, err := strconv.ParseBool(args[index]) if err != nil { return nil, errors.New( ctx.Lang.Validations.ParametersValidations.InvalidBool.Str(), ) } return b, err }, }
View Source
var ParameterInt = &command.ParameterType{ BaseType: TypeInt, Name: "int", Parser: func(ctx *command.Context, index int, args []string) (any, error) { i, err := strconv.Atoi(args[index]) if err != nil { return nil, errors.New( ctx.Lang.Validations.ParametersValidations.InvalidInt.Str(), ) } return i, err }, }
View Source
var ParameterLowerCasedString = &command.ParameterType{ BaseType: TypeString, Name: "lower cased string", Parser: func(ctx *command.Context, index int, args []string) (any, error) { return strings.ToLower(args[index]), nil }, }
View Source
var ParameterString = &command.ParameterType{ BaseType: TypeString, Name: "string", Parser: func(ctx *command.Context, index int, args []string) (any, error) { return args[index], nil }, }
View Source
var ParameterText = &command.ParameterType{ BaseType: TypeString, Name: "text", Parser: func(ctx *command.Context, index int, args []string) (any, error) { return strings.Join(args[index:], " "), nil }, }
Functions ¶
This section is empty.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.