Variables

Variables let Firebot insert dynamic values into supported text fields.

You can use variables in chat messages, effect settings, overlay widgets, conditions, commands, events, timers, hotkeys, counters, Channel Rewards, Power-Ups, and any other field that supports variables.

Anywhere you see the $vars button or a field that supports variables, you can use values like $user, $counter[name] or $date.


Using Variables

Most variables start with $.

For example: Hello $user!

Some variables use brackets to pass in a value: $counter[BlameChat]

Some variables can read nested data from custom variables, effect outputs, objects, or arrays: $customVariable[profile, stats.wins]

The $vars menu includes Macros, Global Values, and categories such as Common, Trigger Based, User Based, Text, Numbers, Advanced, Integrations, and OBS.


Macros

Macros are reusable variable expressions.

Use them when you have a variable expression that you want to reuse in multiple places.

You can manage Macros from the $vars menu by selecting Macros, then clicking Add Macro.

Use $%name to run a macro.

For example: $%shoutoutMessage

Macros can also use arguments. Add arguments in the macro editor, then use them inside the macro expression.

Use $^name inside the macro to read an argument.

VariableDescription
$%nameRuns the macro named name.
$%name[arg1, arg2]Runs the macro with arguments.
$^nameGets a named argument inside a macro.

Global Values

Global Values are static values that can be reused anywhere variables are supported.

They are useful for links, common text, usernames, API keys, or other values you do not want to type in multiple places.

You can manage Global Values from the $vars menu by selecting Global Values, then clicking Manage Global Values.

Use $!name to insert a Global Value.

For example: $!discordLink

Global Values can be marked as Secret. Secret values are hidden in the UI, but should still be treated like sensitive data.

VariableDescription
$!nameGets the global value named name.

Custom Variable Shortcuts

Custom variables are created with the Custom Variable effect.

These shortcuts let you read custom variables and effect outputs without writing the full variable name.

For example: $$example

This is the same as: $customVariable[example]

VariableDescription
$$nameGets the value of the custom variable named name.
$$name[path, to, value]Gets a nested value from the custom variable.
$&nameGets the value of the effect output named name.
$&name[path, to, value]Gets a nested value from the effect output.

Common Variables

VariableDescription
$userThe user connected to the current trigger.
$targetThe target user, when one is available.
$streamerThe streamer account username.
$botThe bot account username.
$dateThe current date.
$timeThe current time.
$uptimeThe current stream uptime.
$categoryThe current Twitch category or game.
$gameAlias for $category.
$streamTitleThe current stream title.
$currentViewerCountThe current stream viewer count.
$counter[name]The current value of the selected counter.

Trigger Based Variables

These variables depend on what triggered the effect.

They are commonly used with commands, events, rewards, Power-Ups, counter updates, loops, and effect outputs.

VariableDescription
$counterChangeShows how much the counter increased or decreased.
$counterMaximumShows the maximum value of the counter, or an empty string if there is no maximum.
$counterMinimumShows the minimum value of the counter, or an empty string if there is no minimum.
$counterNameShows the name of the counter.
$counterNewValueShows the new value of the counter.
$counterPreviousValueShows the previous value of the counter.
$effectOutput[name]Gets data output by a prior effect.
$loopCountGets the current loop count inside a Loop Effects effect.
$loopItemGets the current loop item inside a Loop Effects effect.
$powerUpCostGets the Bit cost of the current Power-Up.
$powerUpDescriptionGets the description of the current Power-Up.
$powerUpImageUrlGets the image URL of the current Power-Up.
$rewardCostGets the channel point cost of the current Channel Reward.
$rewardDescriptionGets the description of the current Channel Reward.
$rewardImageUrlGets the image URL of the current Channel Reward.

User Based Variables

VariableDescription
$accountCreationDateGets the creation date of the streamer's Twitch account.
$accountCreationDate[username]Gets the creation date for a specific Twitch account.
$activeChatUserCountGets the number of active viewers in chat.
$activeChatUserCount[role]Gets the number of active chat users in a custom role.
$chatMessagesGets the number of chat messages for the current viewer.
$chatMessages[username]Gets the number of chat messages for a specific viewer.
$chatUserColorGets the chat color for the current user.
$chatUserColor[username]Gets the chat color for a specific user.
$chatUserCountGets the total number of current users in chat.
$chatUserCount[role]Gets the total number of chat users in a custom role.
$customRoleUserCount[role]Gets the number of people in a custom role.
$customRoleUsers[role]Gets display names for users in a custom role.
$isUserInChat[username]Returns true if the user is currently in Twitch chat.
$joinDateGets the date the current viewer was first seen by Firebot.
$joinDate[username]Gets the date a specific viewer was first seen by Firebot.
$lastSeenGets the date the current viewer was last seen by Firebot.
$lastSeen[username]Gets the date a specific viewer was last seen by Firebot.
$randomActiveViewerGets a random active chatter.
$randomCustomRoleUser[role]Gets a random user from a custom role.
$randomViewerGets a random online viewer in chat.
$userAvatarUrlGets the avatar URL for the current user.
$userProfileImageUrlAlias for $userAvatarUrl.
$userBioGets the bio for the current user.
$userAboutAlias for $userBio.
$userDescriptionAlias for $userBio.
$userDisplayNameGets the formatted display name for the current user.
$userDisplayName[username]Gets the formatted display name for a specific user.
$userExists[username]Returns true if the user exists in Firebot's database.
$userIdGets the user ID for the current user.
$userId[username]Gets the user ID for a specific user.
$userIsBanned[username]Returns true if the user is currently banned.
$userIsTimedOut[username]Returns true if the user is currently timed out.
$usernameArrayReturns an array of all usernames saved in Firebot's user database.
$userRolesReturns all roles for the current user.
$userRoles[username]Returns roles for a specific user.
$vipArrayReturns an array of all VIPs.
$viewTimeGets the view time for the current viewer.
$viewTime[username]Gets the view time for a specific viewer.

Twitch Channel Variables

VariableDescription
$categoryGets the current category or game for your channel.
$category[username]Gets the current category or game for a specific channel.
$categoryImageUrlGets the image URL for the last streamed category.
$categoryImageUrl[username]Gets the category image URL for a specific channel.
$followAge[username]Gets how long a viewer has followed the channel.
$followCountGets your current follower count.
$followCount[username]Gets the follower count for a specific channel.
$isAdBreakRunningReturns whether an ad break is currently running.
$isChannelLiveReturns whether your Twitch channel is live.
$isChannelLive[username]Returns whether a specific channel is live.
$isSharedChatEnabledReturns whether the channel is in a shared chat session.
$latestClipUrlGets the URL for the most recent Twitch clip.
$latestClipUrl[username]Gets the URL for the most recent clip from a specific channel.
$latestFollowerGets the most recent follower.
$randomClipUrlGets a random Twitch clip URL.
$randomClipUrl[username]Gets a random clip URL from a specific channel.
$secondsUntilNextAdBreakGets the number of seconds until the next scheduled ad break.
$sharedChatParticipantsGets shared chat participant data.
$streamTitleGets the current stream title.
$streamTitle[username]Gets the stream title for a specific channel.
$subCountGets the current sub count.
$subNamesReturns an array of subscribers.
$subPointsGets the current sub point count.
$twitchChannelUrl[channelName]Gets the Twitch channel URL for a channel name.
$twitchVodUrlGets the current Twitch VOD URL.
$twitchVodUrl[true]Gets the current Twitch VOD URL with the current timestamp.

Channel Goal Variables

Goal types include follow, sub, subpoint, newsub, and newsubpoint.

VariableDescription
$channelGoalCurrentAmountGets the current amount for the active channel goal.
$channelGoalCurrentAmount[type]Gets the current amount for a specific goal type.
$channelGoalDescriptionGets the description for the active channel goal.
$channelGoalDescription[type]Gets the description for a specific goal type.
$channelGoalTargetAmountGets the target amount for the active channel goal.
$channelGoalTargetAmount[type]Gets the target amount for a specific goal type.

Bits, Rewards, and Power-Ups

VariableDescription
$bitsCheered[username]Gets the all-time Bits cheered by a user.
$bitsCheered[username, period]Gets Bits cheered by a user during a period.
$bitsLeaderboard[count]Gets the all-time Bits leaderboard.
$bitsLeaderboard[count, period]Gets the Bits leaderboard for a period.
$powerUpCost[name]Gets the Bit cost of a specific Power-Up.
$powerUpDescription[name]Gets the description of a specific Power-Up.
$powerUpImageUrl[name]Gets the image URL of a specific Power-Up.
$rewardCost[name]Gets the channel point cost of a specific Channel Reward.
$rewardDescription[name]Gets the description of a specific Channel Reward.
$topBitsCheerersGets the top Bits cheerer.
$topBitsCheerers[count]Gets multiple top Bits cheerers.
$topBitsCheerers[count, period]Gets top Bits cheerers for a period.

Counter Variables

VariableDescription
$counter[name]Displays the value of the given counter.
$counterChangeShows how much the counter increased or decreased.
$counterMaximumShows the maximum value of the counter, or an empty string if there is no maximum.
$counterMinimumShows the minimum value of the counter, or an empty string if there is no minimum.
$counterNameShows the name of the counter.
$counterNewValueShows the new value of the counter.
$counterPreviousValueShows the previous value of the counter.

Currency Variables

VariableDescription
$currency[currencyName, user]Gets how much currency a user has.
$currencyRank[currencyName, user]Gets a user's rank for the selected currency.
$rawTopCurrency[currencyName]Returns a raw array of users with the most of the selected currency.
$topCurrency[currencyName]Gets a comma-separated list of users with the most of the selected currency.
$topCurrency[currencyName, count]Gets a limited list of top currency users.
$topCurrencyUser[currencyName, position, username]Gets the username at a specific position in the currency leaderboard.
$topCurrencyUser[currencyName, position, amount]Gets the amount at a specific position in the currency leaderboard.

Rank Variables

VariableDescription
$rankLadderMode[rankLadderName]Gets the mode of a rank ladder.
$rankValue[rankLadderName, rankName]Gets the threshold value for a rank.
$rankValueDescription[rankLadderName, rankName]Gets the threshold value description for a rank.
$viewerHasRank[username, rankLadderName, rankName]Returns whether a viewer has a specific rank.
$viewerNamesInRank[rankLadderName, rankName]Gets viewer names in a rank.
$viewerNextRank[username, rankLadderName]Gets the next rank for a viewer.
$viewerRank[username, rankLadderName]Gets a viewer's current rank.
$viewersInRankArray[rankLadderName, rankName]Gets raw viewer objects in a rank.

Metadata Variables

VariableDescription
$rawTopMetadata[metadataKey]Returns a raw array of users with the most of a metadata value.
$topMetadata[metadataKey]Gets a comma-separated list of users with the most of a metadata value.
$topMetadata[metadataKey, count]Gets a limited metadata leaderboard.
$topMetadataUser[metadataKey, position, username]Gets the username at a specific metadata leaderboard position.
$topMetadataUser[metadataKey, position, amount]Gets the amount at a specific metadata leaderboard position.
$userMetadata[username, metadataKey]Gets metadata for a user.
$userMetadata[username, metadataKey, defaultValue]Gets metadata for a user with a fallback value.

Quote Variables

Quote object properties include id, createdAt, creator, originator, text, and game.

VariableDescription
$quoteGets a random quote.
$quote[#]Gets a specific quote by ID.
$quoteAsObjectGets a random quote as a JSON object.
$quoteAsObject[#]Gets a specific quote as a JSON object.
$quoteAsObject[#, property]Gets one property from a specific quote.
$quoteAsObject[null, property]Gets one property from a random quote.

Text Variables

VariableDescription
$capitalize[text]Capitalizes the first letter and lowercases the rest.
$commafy[number]Adds commas to a number.
$concat[text, text]Joins text together.
$decodeFromHtml[text]Decodes HTML-encoded text.
$decodeFromUrl[text]Decodes URL-encoded text.
$encodeForHtml[text]Encodes text for safe use in HTML templates.
$encodeForUrl[text]Encodes text for use in a URL.
$evalVars[text]Evaluates variables inside a string of text.
$lowercase[text]Makes text lowercase.
$replace[textInput, searchValue, replacement]Replaces text with another value.
$replace[textInput, searchValue, replacement, true]Replaces text using a regular expression.
$scrambleText[text]Scrambles the input text.
$splitText[text, separator]Splits text into an array.
$sprintf[template, values]Formats text using a template.
$textContains[text, search]Returns true if the text contains the search value.
$textLength[text]Returns the length of the text.
$textPadEnd[input, count, countIsLength, padChar]Pads the end of text.
$textPadStart[input, count, countIsLength, padChar]Pads the start of text.
$textSubstring[text, start, end]Gets part of a text value.
$trim[text]Removes whitespace from the start and end of text.
$trimEnd[text]Removes whitespace from the end of text.
$trimStart[text]Removes whitespace from the start of text.
$uppercase[text]Makes text uppercase.
$word[text, #]Gets a word from a sentence by position.

Numbers Variables

VariableDescription
$ceil[num]Rounds a number up.
$ensureNumber[input, defaultNumber]Returns the input if it is a number, otherwise returns the default number.
$floor[num]Rounds a number down.
$math[expression]Evaluates a math expression.
$max[num1, num2]Returns the highest number.
$min[num1, num2]Returns the lowest number.
$ordinalIndicator[number]Adds an ordinal suffix such as st, nd, or rd.
$padNumber[value, places]Pads a number to a decimal place count.
$randomNumber[min, max]Gets a random number between the selected range.
$rollDice[diceConfig]Rolls dice, such as 1d6 or 2d10+1d12.
$round[num]Rounds a number to the nearest whole number.
$round[num, places]Rounds a number to a specific number of decimal places.

Date and Time Variables

VariableDescription
$dateGets the current date formatted as MMM Do YYYY.
$date[format]Gets the current date using a custom Moment.js format.
$date[format, amount, unit]Gets a date with time added or subtracted.
$formatDuration[seconds]Formats seconds into a readable duration.
$timeGets the current time.
$time[format]Gets the current time using a custom Moment.js format.
$unixTimestampGets the current Unix timestamp.
$unixTimestamp[date]Gets the Unix timestamp for a specific date.
$unixTimestamp[date, format]Gets the Unix timestamp for a date with a custom format.

Advanced Variables

Logic variables are mostly used inside $if[].

For example: $if[$user === Firebot, Hello Firebot!, Hello!]

VariableDescription
$if[condition, when_true, when_false]Returns one value if the condition is true and another if it is false.
$ALL[condition, condition]Returns true if all conditions are true.
$AND[condition, condition]Alias for $ALL[].
$ANY[condition, condition]Returns true if any condition is true.
$OR[condition, condition]Alias for $ANY[].
$NALL[condition, condition]Returns true if any condition is false.
$NAND[condition, condition]Alias for $NALL[].
$NANY[condition, condition]Returns true if all conditions are false.
$NOR[condition, condition]Alias for $NANY[].
$NOT[condition]Returns the opposite of the condition.
$trueReturns a literal true boolean value.
$falseReturns a literal false boolean value.
$nullReturns a literal null value.

Array Variables

VariableDescription
$arrayAdd[array, new-item]Returns a new array with an item added to the end.
$arrayAdd[array, new-item, true]Returns a new array with an item added to the start.
$arrayElement[array, index]Gets an item from an array by index.
$arrayElement[array, first]Gets the first item from an array.
$arrayElement[array, last]Gets the last item from an array.
$arrayFilter[array, matcher, propertyPath, removeMatches]Returns a filtered array.
$arrayFind[array, matcher]Finds a matching item or returns the text null.
$arrayFindIndex[array, matcher]Finds a matching item and returns its index.
$arrayFindWithNull[array, matcher]Finds a matching item or returns a literal null.
$arrayFrom[value, value]Creates a raw array from the listed values.
$arrayFuzzySearch[array, search]Finds the closest matching item in an array.
$arrayJoin[array, separator]Joins array items into text.
$arrayLength[array]Gets the number of items in an array.
$arrayRandomItem[array]Gets a random item from an array.
$arrayRemove[array, index]Removes an item from an array by index.
$arrayRemove[array, first]Removes the first item from an array.
$arrayRemove[array, last]Removes the last item from an array.
$arrayReverse[array]Reverses an array.
$arrayShuffle[array]Shuffles an array.
$arraySlice[array, start, end]Gets part of an array.

Object and JSON Variables

VariableDescription
$convertFromJSON[json text]Converts JSON text into a raw object.
$convertToJSON[rawValue]Converts a raw value into JSON text.
$convertToJSON[rawValue, true]Converts a raw value into pretty-printed JSON text.
$customVariable[name]Gets data saved in a custom variable.
$customVariable[name, property]Gets a nested property from a custom variable.
$customVariable[name, null, defaultValue]Gets a custom variable with a fallback value.
$customVariableKeys[name]Gets keys from an object saved in a custom variable.
$effectOutput[name]Gets data output by a prior effect.
$effectOutput[name, property]Gets a nested property from an effect output.
$effectOutput[name, property, defaultValue]Gets effect output data with a fallback value.
$objectKeys[object]Gets the keys for an object.
$objectWalkPath[object, path.to.value]Gets a nested value from an object.
$quickStore[key]Gets a temporary stored value.
$quickStore[key, value]Stores a temporary value for the current variable evaluation.
$rawCustomVariable[name]Gets raw data saved in a custom variable.
$rawCustomVariable[name, property]Gets a nested raw value from a custom variable.
$rawCustomVariableKeys[name]Gets keys from a raw custom variable object.
$setObjectProperty[object, propertyPath, value]Adds, updates, or removes a property from an object.

File, API, and Media Variables

VariableDescription
$audioDuration[filePathOrUrl]Gets the duration of an audio file or URL in seconds.
$fileExists[path]Returns true if a file exists.
$fileLineCount[path]Counts the number of lines in a text file.
$fileName[path]Gets the file name without the extension.
$filesInDirectory[path]Gets files in a directory.
$filesInDirectory[path, regexp, flags]Gets files in a directory matching a regular expression.
$overlayResourcesPathGets the full path to the overlay resources folder.
$overlayResourcesPath[sub, dir, file]Gets a path inside the overlay resources folder.
$readApi[url]Calls a URL and returns the response as text.
$readApi[url, object.path.here]Gets a nested value from a JSON API response.
$readFile[path]Reads the contents of a text file.
$readFile[path, line]Reads a specific line from a text file.
$readFile[path, first]Reads the first line from a text file.
$readFile[path, last]Reads the last line from a text file.
$readFile[path, random]Reads a random line from a text file.
$readFile[path, array]Reads a text file as an array.
$readFile[path, bytes]Reads a file as a byte array.
$videoDuration[filePathOrUrl]Gets the duration of a video file or URL in seconds.

Encoding Variables

VariableDescription
$atob[string]Decodes a base64 string.
$base64Decode[string]Decodes a base64 string.
$base64Encode[string]Encodes text into base64.
$btoa[string]Encodes text into base64.

Regular Expression Variables

VariableDescription
$regexExec[string, expression]Runs a regular expression and returns the result.
$regexExec[string, expression, flags]Runs a regular expression with flags.
$regexMatches[string, expression]Returns all regular expression matches.
$regexMatches[string, expression, flags]Returns all regular expression matches with flags.
$regexTest[string, expression]Returns true if the text matches the regular expression.
$regexTest[string, expression, flags]Returns true if the text matches the regular expression with flags.

OBS Variables

VariableDescription
$obsColorValueConverts a color into an OBS color value.
$obsInputActiveReturns whether the OBS input is active.
$obsInputAudioBalanceGets the audio balance for the OBS input.
$obsInputAudioSyncOffsetGets the audio sync offset for the OBS input.
$obsInputAudioTracksGets the raw OBS audio tracks object.
$obsInputKindGets the OBS internal input kind.
$obsInputMonitorTypeGets the OBS audio monitor type.
$obsInputMutedReturns whether the OBS input is muted.
$obsInputNameGets the OBS input name.
$obsInputSettingsGets the raw OBS input settings object.
$obsInputShowingReturns whether the OBS input is showing.
$obsInputUuidGets the OBS input UUID.
$obsInputVolumeDbGets the OBS input volume in dB.
$obsInputVolumeMultiplierGets the OBS input volume multiplier.
$obsIsConnectedReturns whether OBS is connected.
$obsIsRecordingReturns whether OBS is recording.
$obsIsStreamingReturns whether OBS is streaming.
$obsOldInputNameGets the previous OBS input name.
$obsSceneCollectionNameGets the OBS scene collection name.
$obsSceneNameGets the OBS scene name.

Overlay Variables

VariableDescription
$overlayWidgetState[nameOrId]Gets the state of an overlay widget.
$overlayWidgetState[nameOrId, path.to.value]Gets a nested value from an overlay widget state.

Effect Variables

Use $runEffect[] only when you know what the effect JSON should look like.

VariableDescription
$effectQueueLength[queueName]Gets the number of effects in an effect queue.
$evalJs[`` code ``]Evaluates JavaScript in a sandboxed browser instance.
$evalJs[`` code ``, parameter]Evaluates JavaScript with parameters.
$runEffect[effectJson]Runs an effect from effect JSON.

Integrations Variables

VariableDescription
$extraLifeDonationsGets Extra Life donation data.
$extraLifeDonations[amount]Gets top donation data.
$extraLifeDonations[createdDateUTC, count, participantID]Gets recent donations.
$extraLifeIncentivesGets Extra Life incentive data.
$extraLifeIncentives[description]Gets an incentive by description.
$extraLifeInfoGets Extra Life profile data.
$extraLifeInfo[property]Gets a specific Extra Life profile property.
$extraLifeMilestonesGets Extra Life milestone data.
$extraLifeMilestones[goal]Gets a milestone by goal amount.

Random Variables

VariableDescription
$randomAdviceGets random advice.
$randomDadJokeGets a random dad joke.
$randomRedditImage[subredditName]Gets a random image from a subreddit.
$randomUUIDGets a random formatted UUID.

Variable Example: Random Reply

You want a command that gives a random answer from a small list.

  1. Open Commands in Firebot.
  2. Create or edit the command you want to use, for example !answer.
  3. Add a Chat effect.
  4. Use $arrayRandomItem[] with $arrayFrom[] in the chat message.

Example message:

  • $arrayRandomItem[$arrayFrom[Yes, No, Maybe, Ask again later]]

When the command runs, Firebot picks one item from the list and posts it in chat.

Variable Example: Countdown to a Date

You want a command that shows how many days are left until an event.

  1. Open Commands in Firebot.
  2. Create or edit the command you want to use, for example !countdown.
  3. Add a Chat effect.
  4. Use $unixTimestamp[], $math[], and $floor[] to compare the event date with the current time.

Example message:

  • There are $floor[$math[($unixTimestamp[2026-10-31, YYYY-MM-DD] - $unixTimestamp) / 86400]] days until Halloween!

When the command runs, Firebot converts the event date and the current date into Unix timestamps, subtracts them, then divides by 86400 to turn the result into days.