Repository navigation
Expressions (WIP)
Expressions are plain-text entered into Firebot that may or may not have special text-sequences that get replaced. Expressions are comprised of text, quoted text, escape tokens and functions that are explained in detail below
Within expressions any text including white space that is not quoted text, an escape token, or part of a function is treated as literal text("as is").
Quoted text is replaced with the content within the quotes. Quoted text begins and ends with a ". Within quoted text escape sequences are processed but all other text is treat as is. This means that functions will not be processed within quoted text.
If quoted text is started but a closing " is not found, an error will occur.
See Escape Tokens if you need a literal double-quote in your output.
Functions are tokens that return a result that replaces the token. Functions begin with a $ followed by alphanumeric characters. If the function accepts arguments(parameters), the token is followed by an [, 0 or more comma-separated arguments, then a ]. Each argument can consist of text tokens, quoted tokens, escape tokens, functions or a combination there of.
Within a function's arguments block, white space directly after the [ is ignored, white space directly before and after a comma separator is ignore and white space before the ] is ignored: $var[ a , b ] is treated as $var[a,b]. If you wish to preserve said white space use quoted text: $var[" a "," b "]
The current list of supported functions can be found here
Escape tokens are sequences of characters that get replaced with an underlying value. Unlike functions, they alter how the expression is processed.
| Sequence | Result | Notes |
|---|---|---|
\\ |
\ |
only needed to be escaped if followed by $, ", [, ]
|
\$ |
$ |
Use to escape what would otherwise be treated as a function start in text |
\" |
" |
Use to specify a literal double-quote in text and quoted text |
\[ |
[ |
Use just after a function to include a literal opening bracket |
\] |
] |
Use within a function's argument to insert a literal closing bracket |
The most basic expression is text. Very little needs to be done to turn text into a valid expression. Simply escape occurrences of ", $, and \ within the text.
| Expression | Result | Notes |
|---|---|---|
text |
text |
|
\"text |
"text |
literal " followed by text
|
\$text |
$text |
literal $ followed by text
|
\text |
\text |
literal \ followed by text
|
\\text |
\\text |
literal \ followed by text. This is a poor example as the backslash may but does not need to be escaped in this case |
If you wish to reduce the characters required to be escaped or need to perseve whitespace in a function's argument, you can use quoted text:
| Expression | Result | Notes |
|---|---|---|
"text" |
text |
|
"c:\$f" |
c:\$f |
neither the \ nor $ needed to be escaped |
"$text" |
$text |
Literal $ followed by text
|
"\"text" |
"text |
Literal " followed by text
|
"text\\" |
text\ |
text followed by a literal \
|
$var[" text "] |
The first argument passed to $var will have one leading and one trailing space |
Todo
Todo
Still need help? Come chat with us in the #help channel of our Discord server.