For the complete documentation index, see llms.txt. This page is also available as Markdown.

Input Validation

Input validation restricts prompt inputs using regular expressions, online player checks, or JavaScript expressions.

To use input validation:

  1. Define a validator in prompt-config.yml under Input-Validation.

  2. Apply it using the -iv:<alias> prompt flag.


Validator Types

Validator Type
Config Key
Description

Regex

Regex

Validates if the input matches a regular expression pattern.

Online Player

Online-Player

Validates if the input matches the name of an online player.

JS Expression

JS-Expression

Validates by evaluating a JavaScript expression.


Configuration Example (prompt-config.yml)

Input-Validation:
  Integer-Sample:
    Alias: is
    Regex: '^\d+'
    Err-Message: '&cPlease enter a valid integer!'
  Alpha-Sample:
    Alias: ss
    Regex: '[A-Za-z ]+'
    Err-Message: '&cInput must only consist of letters!'
  Online-Validator:
    Alias: ov
    Online-Player: true
    Err-Message: '&cThat player is not online!'

Usage

Apply the validator to a prompt using -iv:<alias>:

If validation fails, the Err-Message is sent to the player, and the prompt is re-displayed.

Useful Resource: Learn more about Regular Expressions.

Last updated

Was this helpful?