Skip to content

Expressions (WIP)

SReject edited this page Feb 9, 2020 · 15 revisions

Expressions are plain-text entered into Firebot that may or may not have special text-sequences that get replaced. Expressions are comprised of Escape Tokens, Text, Quoted Text, and Variables that are explained in detail below

TODO: [Current List of Supported Variables]()

Escape Tokens

Escape tokens are sequences of characters that get replaced with an underlying value.

Sequence Result Notes
\\ \ only needed to be escaped if followed by $, ", [, ]
\$ $ Use to escape what would otherwise be treated as a variable start in text
\" " Use to specify a literal double-quote in text and quoted text
\[ [ Use just after a variable to include a literal opening bracket
\] ] Use within a variable's argument to insert a literal closing bracket

Text

Within expressions any text that is not an Escape Token, Quoted Text, or part of a Variable is treated as literal text("as is").

Examples

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

Quoted Text

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 variables 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.

Examples

Expression Result Notes
"text" text
"$text" $text Literal $ followed by text
"\"text" "text Literal " followed by text
"c:\$f" c:\$f Neither the \ nor $ needed to be escaped
"text\\" text\ text followed by a literal \

Variables

Variables are tokens within the expression that return a result which replaces the variable token.

Variables begin with a $ followed by alphanumeric characters. If the variable accepts arguments(parameters), the token is followed by an [, 0 or more comma-separated arguments, then a ]. Each argument can consist of Escape Tokens, Text, Quoted Text, variables or a combination there of.

Within a variable'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.

The current list of supported variables can be found here

Examples

Expression Arguments Result Notes
$bot Firebot The variable does not take arguments
$lowercase[TEXT] TEXT text The variable takes one argument
$lowercase[ TEXT ] TEXT text The whitespace after [ and before ] is removed
$lowercase[" TEXT "] TEXT text The whitespace is perseved
$lowercase[$bot] Firebot firebot Variables can be nested
todo...

Concatenation

To Do

Clone this wiki locally