Skip to content

Advanced Custom Commands (AST)

See when a custom command calls for AST—counters, per-viewer state, conditionals, loops, and function calls—and jump to the syntax, functions, execution, and recipes guides.

AST is the scripting layer built into custom commands. Whenever a static reply falls short, AST lets a single command save values, branch on conditions, call Twitch or overlay functions, and trigger other commands.

Every command reply starts as plain text. The moment you add an AST prefix—$(, %(, *(, ^(, %del(, or #(—the bot evaluates that piece as AST.

Plain text is enough when…Use AST when…
The message stays the same every timeThe reply tracks changing numbers, such as a counter
You only want a link or a fixed blurbThe command needs to remember values across runs
You want if/else branching, random picks, or loops
You want to call a bot function or chain another command

Plain text (no AST):

Terminal window
Join our Discord: example.com/discord

AST (a counter that ticks up every run):

Terminal window
*( ^(#wins) ? %(#wins *(%(#wins) + 1)) : %(#wins 1) ) $(user) has %(#wins) wins!

Here is how that command runs:

  1. Checks if #wins already exists.
  2. If it does, increments it by 1; otherwise, initializes it to 1.
  3. Replies with the updated total—for example, Carlos has 3 wins!.

DomDimaBot does not pre-populate AST variables for you.

  • You define a variable by assigning it directly: %(name value).
  • Built-in context comes from functions such as $(user) and $(twitch.game), or from chat arguments like &p1.
Terminal window
%(#wins *(%(#wins) + 1)) $(user) now has %(#wins) wins!
  • tracking counters and viewer progress
  • crafting dynamic, personalized replies
  • branching with if / else logic
  • working with lists and loops
  • running Twitch, moderation, availability, TTS, roulette, trigger, and EventSub functions
  • scheduling delayed AST actions that persist across bot restarts
  • chaining commands together

The AST documentation is organized into four focused references:

  1. AST Syntax & Data

    • expression prefixes and how replies are parsed
    • variables and storage tiers
    • chat arguments and quoted strings
    • escaping special characters
    • lists, operators, conditionals, and loops
    • deleting values, existence checks, command references, and timers
  2. AST Functions Reference

    • user and Twitch data functions
    • moderation, channel, availability, and roulette actions
    • counters, clips, and followage
    • polls, predictions, EventSub, TTS, triggers, and chat sending
  3. AST Execution, Errors & Limits

    • step-by-step parser execution
    • delayed timer execution and restart recovery
    • common error messages
    • loop and recursion limits
    • practical debugging tips
  4. AST Recipes & Patterns

    • copy-ready best practices
    • initialize-or-increment counters
    • existence guard checks
    • per-viewer selectors
    • timed actions and prediction/poll patterns

Picture AST expressions as mini-scripts embedded inside a chat reply:

  • %(...) = read or write your own variables
  • %del(...) = delete a variable or remove an item from a list
  • $(...) = call a function
  • *(...) = evaluate math, conditions, or a loop
  • ^(...) = check whether a variable or list slot exists
  • #(...) = trigger another command after this one

A few AST limits and storage options scale with the streamer’s plan:

FeatureFreePremiumPro
Memory variablesYesYesYes
Cache variables (#, ##)YesYesYes
Database variables (*, **)Writes are ignoredYesYes
Loops nested inside each other234
Passes per loop2550100
  1. Start with a plain text reply.
  2. Mix in viewer arguments such as &p1.
  3. Drop in functions like $(user) or $(twitch.game).
  4. Introduce variables only when the command actually needs state.
  5. Layer on conditionals and loops last.

Docs assistant

Ask in your own words. Answers come from these docs, with links to the right page.

Try asking

Current page: Advanced Custom Commands (AST)

AI can make mistakes. Check the linked page.