Input Validation
Last updated
Last updated
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
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.
Validator | Key | Description |
---|---|---|
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
Regex
Regex
validates an input by checking if it matches the defined regular expression
Online Player
Online-Player
validates an input by checking if it's a username of one of the online players