Conditions
A Condition node checks one or more conditions, then follows its Yes or No output. For more than two cases, chain several Conditions.
One condition
In the properties panel, a condition reads as a sentence: the value checked, the condition, then what it needs.
| For a value of type | Conditions offered |
|---|---|
| Number | equals, does not equal, is greater than, is at least, is less than, is at most, is one of |
| Text | equals, contains, starts with, ends with, matches the pattern, is one of… |
| Date | is before, is after, is more than … ago, is less than … ago (minutes, hours, days, weeks, months, years) |
| List | contains, does not contain |
| Member | has the role, doesn't have the role, has the permission, doesn't have the permission |
| Any | is empty, is not empty |
The menu only offers what makes sense for the chosen value. For a value whose type is only known at execution (a Variable), it offers everything.
A value written as is takes the type of what it's compared with: 18 next to a number is a number, true next to true or false is a boolean. An inserted value keeps its type: a number never equals a text, not even 21 and "21". See Expressions.
Checking a member
"Has the role" and "has the permission" check a member from Discord: whoever triggered the Event (offered by default), a context menu's target, a command's "user" option. Never a text, not even an id: anyone could type an administrator's in a modal. An administrator has every permission.
Formula
The Formula tab replaces the condition with a formula that gives true or false, with and, or, not and comparisons: {{ level >= 5 and not banned }}, or {{ random(1, 100) <= 30 }} for a one-in-three chance.
Several conditions
Add a condition creates an "All of these" group and opens the conditions canvas. A group is true when all its conditions are true, or at least one. It can hold other groups, and be inverted as a whole: "none of these", "not all of these". In the panel, the group reads as sentences. In the conditions window, click a condition or a group on the canvas to set it up on the right; Cancel puts the conditions back as they were when you opened it.
When a condition can't be checked
The editor flags, before a test or a deploy, a condition that can't work: a text compared with a number, an invalid pattern, a member that doesn't come from Discord. If a condition still can't be checked at execution (a Variable holding text where a number is needed), the execution stops with an error, its message in Executions, rather than silently following "No".
Following "No" isn't a failure: the execution counts as successful, and its detail says in one sentence how the Condition answered, with the values it compared (“reset” does not equal “gagner”).
A pattern follows the RE2 syntax, at most 500 characters: lookarounds like (?=…) and backreferences like \1 aren't supported.