Template variables & built-ins
Template variables
Insert these tokens anywhere in a command response template:
| Token | Description |
|---|---|
$(user) | Display name of the viewer who triggered the command. |
$(touser) | First argument after the command trigger, or empty if none given. |
$(channel) | Login name of the channel. |
$(query) | Full message text after the command trigger. |
$(args) | All arguments joined with spaces. |
$(1), $(2), … | Individual positional arguments (1-indexed) — $(1) is the first word after the trigger. The brackets are required: a bare $1 is ordinary text, so a response can quote a dollar amount ($5, $1605) without it being eaten. The command editor and the !addcom reply both point out a $1 that looks like it was meant as a variable. Inside a $(counter …) token, $1 is the placeholder that token defines, and does resolve. |
$(count) | How many times this command has been used in this channel. |
$(uptime) | How long the stream has been live (e.g. “1h 23m 45s”), or offline message. |
$(game) | Current game/category set on the channel. |
$(title) | Current stream title. |
$(random MIN-MAX) | Random integer between MIN and MAX inclusive, e.g. $(random 1-20). MIN may be negative — $(random -5-5). Use it more than once in a response and each one rolls independently, so $(random 1-6) + $(random 1-6) is two dice. |
$(randomchatter [FILTER]) | Display name of a random viewer currently in chat. FILTER is the same comma-separated syntax as the bot API (sub, not_sub, tier1–tier3, vip, mod, follower, not_follower), e.g. $(randomchatter sub). Use it more than once in a response and each one picks a different person, so $(randomchatter) vs $(randomchatter) vs $(randomchatter) is a three-way draw. Reads the live chatter list, so it needs the stream to be live; it resolves to [no chatters] when nobody matches. |
$(randompick A|B|C) | One option picked at random from a list. Separate the options with | — $(randompick heads|tails) — or quote them and separate with spaces, which is what an imported StreamElements ${random.pick} looks like: $(randompick 'moonberry tea' 'frog juice'). Apostrophes and quotes inside a phrase need no escaping. Quote an option to protect a | or a ( ) inside it — $(randompick "a (b)" "c|d"). Use it more than once in a response and each one draws independently, so two identical picks can disagree. |
$(counter NAME [op N] [of TARGET]) | Persistent whole-number counter saved per channel. Defaults to a per-viewer (user-level) tally; of channel makes it one shared channel-wide number. op is add/sub/set; omit it to read. See the AI token DSL page for the full grammar. |
$(followers) | Total number of people following the channel. Reads live from Twitch (cached 60 seconds). Also accepted as $(followcount). |
$(subs) | Total number of active subscribers. Also accepted as $(subcount). Affiliate/Partner only — it resolves to [subs: unavailable] on a channel Twitch will not report subscriptions for. |
$(subpoints) | Total subscriber points (Tier 1 = 1, Tier 2 = 2, Tier 3 = 6) — the number Twitch counts toward sub-point goals. Affiliate/Partner only. |
$(plus [FIELD]) | Twitch Plus Program points for the month in progress, the same figure the Numbers module and your Plus goal overlay show. FIELD is points (default), level (Plus level at that figure), next (points needed for the next level in total), needed (points still to go), or share (the revenue split at the current level). Readable inside $(eval …) too, so a response can branch on the gap — e.g. $(eval let n = $(plus needed); n > 0 ? …); keep the token outside quoted strings. |
$(hypehigh FIELD) | Hype-train all-time-high stats, where FIELD is level (default), total, percent, shared_level, or shared_total. percent is how the current hype train — or the most recent one, between trains — compares to your record, so it counts up live during a train and reads over 100 when one is breaking the record. |
Counters
Counters are the only persistent storage in command templates — a whole-number tally saved per channel.
- Per-viewer (user-level):
$(counter deaths add 1)— increments the triggering viewer’s own tally. - Channel-wide (one shared number):
$(counter deaths add 1 of channel)— everyone’s command writes the same counter. - Read:
$(counter deaths)— returns the current value without changing it. - Leaderboard:
$(counter deaths top)— lists the top viewers (highest value first).
See AI token DSL reference for the full grammar and examples.
HTTP fetch variable
| Token | Description |
|---|---|
$(http URL) | Fetches URL and inserts the response body (plain text, max 10 KB, 3 s timeout). HTTPS only. Max 3 HTTP fetches per command. |
Permission levels
Set the permission field of a command to restrict who can trigger it:
| Level | Who can use it |
|---|---|
everyone | All viewers |
regular | Viewers manually added to the regulars list by a mod |
follower | Viewers who follow the channel |
sub | Active subscribers |
vip | Channel VIPs |
mod | Moderators |
broadcaster | The broadcaster only |
Cooldowns
Commands support two independent cooldowns:
- Global cooldown — channel-wide lockout after each use (seconds).
- User cooldown — per-viewer lockout after each use (seconds).
Both default to 0 (no cooldown). Set via the dashboard or !cooldown.
Command constraints
| Field | Constraint |
|---|---|
| Trigger | Starts with !, letters/numbers/dash/underscore, max 30 chars |
| Response template | Max 500 characters |
| Commands per channel | Max 500 |
Built-in commands
These are always available and can be aliased or disabled from the Chatters dashboard:
| Command | What it does |
|---|---|
!uptime | Replies with how long the stream has been live. |
!game | Reads (or mod-sets) the current category/game. !game Fortnite |
!title | Reads (or permissioned-sets) the stream title. !title Road to 1k! |
!followage | How long the triggering viewer has been following. |
!accountage | How old a Twitch account is. !accountage for yourself, !accountage @someone for another viewer. |
!watchtime | How long a viewer has watched this channel, counted from when tracking started. !watchtime for yourself, !watchtime @someone for another viewer. |
!hypecheck | Time since the last Hype Train ended and how long until the next one can start. |
!commands | Posts a link to the public command list page. |
!addcom | Mod: adds a new custom command. !addcom !hello Hi $(user)! |
!editcom | Mod: updates an existing command response. !editcom !hello Hey $(user)! |
!delcom | Mod: deletes a custom command. !delcom !hello |
!cooldown | Mod: sets global/user cooldown. !cooldown !hello 10 or !cooldown !hello global:30 user:10 |
!so | Mod: shoutout with optional native Twitch shoutout. !so @username — uses a separate offline message when the target is offline; $(status) resolves to live/offline. The native shoutout is queued while Twitch’s 2-minute cooldown is active. |
!soq | Mod: view the native shoutout queue. !soq lists it; !soq remove <user> / !soq clear manage it. |
!timer | Countdown timer. Mod: !timer 5m or !timer 1:30:00 [label]; anyone: !timer shows time left; !timer stop cancels. |
Share Feedback
Need help or want to chat? Join our Discord to get support, report bugs, and talk with other streamers.0 / 1000
Privacy
▸ What we're sending
| Module | — |
| Page | — |
| Browser | — |
| Screen | — |
| Channel | anonymous |
| Submitted | — |