Input Validation
CommandPrompter's input validation uses regex to check for the input. To use it, you have to define an input validator
in the prompt-config.ym
under the key Input-Validation
and use it as a prompt argument
for your prompt
Input Validator
An input validator could have any key. But under that key, there must be an Alias
and at least one#validator. There's also an optional key that you can set called Err-Message
. The following is an example of input validators that's included with CommandPrompter by default.
Validators
Usage
Once you have input validators defined, you can use them by using the prompt argument -iv:<validator alias>
. For example:
Since it's a prompt argument, it won't affect other prompt's input validation so you can have something like the following:
If it doesn't pass the regex test, the plugin sends the error message and sends the prompt again.
To learn more about regular expressions click here
Last updated