Includes Parser
in
and includes
is best for strings
contain
and contains
is best for arrays
The If Statement Parser allows you to create conditional responses based on comparisons between values. It evaluates an expression and returns one of two possible messages depending on whether the condition is true or false.
Usage
To use the parser, insert the following syntax in your text:
{if(expression):trueMessage|falseMessage}
Expression Operators
The following operators are available for creating expressions:
Operator | Description | Example | Meaning |
---|---|---|---|
== | Equality | a==a | Checks if two values are equal |
!= | Inequality | a!=b | Checks if two values are not equal |
> | Greater than | 5>3 | Checks if first value is greater than second |
< | Less than | 4<8 | Checks if first value is less than second |
>= | Greater than or equal | 10>=10 | Checks if first value is greater than or equal to second |
<= | Less than or equal | 5<=6 | Checks if first value is less than or equal to second |
Examples
- Simple comparison:
- Input:
{if(5>3):True|False}
- Output:
True
- Nested conditions:
- Input:
{if({args}==63):You guessed it!|Too {if({args}<63):low|high}, try again.}
- With args=63:
You guessed it!
- With args=73:
Too high, try again.
- With args=14:
Too low, try again.
- Using with placeholders:
- Input:
{if(contains(roleId):{member.roles}):Welcome admin!|Access denied.}
- Output with admin role:
Welcome admin!
- Output without admin role:
Access denied.
Notes
- Expressions can use any valid placeholder values
- Multiple conditions can be nested for complex logic
- The true and false messages are required and must be separated by a pipe (|)
- Whitespace around operators is ignored