Conditionals.
Conditionals let one command react differently to different viewers and situations: greet a sub one way and everyone else another, hide mod tools from regular chat, or roll a chance-based reply, all in a single response.
The block form
Wrap part of a response in an $(if …) block. The bot evaluates the condition and posts only the branch that matches. An $(else) is optional, and every block ends with $(endif).
$(if CONDITION)shown when true$(else)shown when false$(endif)Blocks can nest, so an $(else) branch can hold another $(if …) for a chain of cases.
Writing the condition
A condition is a boolean expression. Combine smaller checks with and, or and not, and group with parentheses. Precedence runs not first, then and, then or, so subscribed and tier >= 2 or mod reads as "(subscribed and tier 2+) or mod". Use parentheses any time you want a different grouping.
subscribed and (tier >= 2 or mod)Comparisons
Either side of a comparison can be a token like $(followers), a named operand like tier, a number, or a "quoted string". Text values must be quoted. Equality is == (a lone = is accepted as a friendly alias), inequality is !=, and the numeric comparisons are >, >=, < and <=. String comparisons are case-insensitive, so "Just Chatting" and "just chatting" match.
Truthiness: a bare operand with no comparison is true when it is a true flag, a non-zero number, or a non-empty string that is not 0 or false. Coercion: when both sides of a comparison look like numbers they compare as numbers, otherwise they compare as text, so $(count) > 100 works even though tokens arrive as strings.
What you can check
Conditions can read viewer status (subscribed, tier, mod, vip, follower, first_time), channel state (live, hour, uptime), and any $( … ) variable. The full list of named operands, with each one's type and meaning, appears in the Conditionals section of the variable reference.
Examples
Start simple. Compare a token to text (the = alias is shown here) to greet one specific viewer:
$(if $(user) = "ninja")the king has arrived 👑$(else)welcome $(user)!$(endif)Check a viewer's tier exactly, with a nested fallback for any other sub:
$(if tier == 3)Tier 3 legend, thank you!$(else)$(if subscribed)thanks for subbing!$(else)hi $(user)$(endif)$(endif)Compare one token against another, here a shouted-out channel's follower count against your own:
$(if $(touser.followers) > $(followers))$(touser) is bigger than us, go follow!$(else)show $(touser) some love$(endif)Match the current category by name:
$(if $(game) == "Just Chatting")grab a seat and chat!$(endif)Reward loyal subs, and nudge everyone else:
hi $(user), $(if subscribed)because you're a loyal sub you get priority!$(else)if you were subbed you'd have a much better chance!$(endif)Unlock a perk for Tier 2 and above:
$(if tier >= 2)Tier 2+ perk unlocked for $(user)!$(endif)Welcome a first-time chatter:
$(if first_time)Welcome to the stream, $(user)! 🎉$(else)wb $(user)$(endif)Show a hint only your mods can see:
$(if mod)Mod tools: !timeout !clip !title$(endif)Run a free, no-API jackpot that hits roughly ten percent of the time:
$(if $(random 1-100) <= 10)💰 JACKPOT $(user)!$(else)no luck, try again$(endif)Greet by time of day:
$(if hour >= 18)Good evening$(else)Good day$(endif), $(user)!Gate a reply on whether you are live:
$(if live)We're live for $(uptime)!$(else)Currently offline, see you next stream.$(endif)Combine several checks in one condition:
$(if subscribed and tier >= 2 or mod)VIP lane$(else)standard queue$(endif)Only the matching branch is evaluated, so tokens in the other branch are never resolved. That makes it safe to put a costly $(api) call or a League $(lol.rank …) lookup inside a branch: it only fires when that branch is the one being posted.