Conditions
Use $if when a message should choose text based on a value. The first true branch is selected; an optional $else supplies an alternative if none is true.
$set(@count, 8)$if(@count > 20) Large$elif(@count > 5) Medium$else Small$endResult:
MediumThe count is eight, so the middle branch appears. You may repeat $elif before at most one $else, and must close the block with $end.
What counts as true
Section titled “What counts as true”false, nil, zero, empty text, and empty collections are false in conditions. Use $if(#@items) to check whether a list has entries. Use $if(@count > 0) if negative numbers should also fail.
Inline choices
Section titled “Inline choices”Hello, $if(true)admin$else visitor$end!Result:
Hello, admin!Inline blocks preserve authored surrounding spaces. For longer text, use standalone blocks and indentation to organize their content.
Even an unselected branch must have valid syntax, because compilation checks the entire field before execution.