Tags

Global

{option;name}

Get the value of a defined option.

Example of how to define options

For this example, we'll assume the user ran the command as /inspect input:example text user:@Sylver#1058

{option;input} // "example text"
{option;user} // "111372124383428608"
{user.username;{option;user}} // "Sylver"

And for this example, we'll assume the user ran the command as /inspect input:example text

{option;input} // "example text"
{option;user} // "", because the user didn't provide a user option

Alternative Syntax

You can also use {?name} as a shorthand for {option;name}.

For example, using the command /inspect input:example text user:@Sylver#1058

{?input} // "example text"
{?user} // "111372124383428608"
NameTypeDescription
namestringThe name of the option to get

{time format to;time}

Formats time as a string. Is compatible with any of the .createdAt tags.

NameTypeDefaultDescription
timeTimecontext DateThe time we should format. Defaults to the current time. Can be a relative time or various date formats.
formatTimestampStylesStringThe format to use. If left out, we return the current unix time instead.
tostringThe Luxon format to use. Incompatible with format
{time}  // 1636084903
{time format=relative_time;5 hours ago} // 5 hours ago
{time;2021-11-05T04:01:43.661Z} // 1636084903
{time format=relative_time;2022-08-21} // in 10 months

{casing mode;input}

Changes the casing of a string.

Accepted modes:

  • lower this is lower case
  • upper THIS IS UPPER CASE
  • first This is first case
  • title This Is Title Case
  • camel thisIsCamelCase
  • constant THIS_IS_CONSTANT_CASE
  • mocking tHiS iS mOcKiNg CaSe
NameTypeDescription
modeCasingModeThe case to transform the input to
inputstringThe string to change the casing of

{length;string_or_array}

Returns the number of characters in a string and the number of elements in an array.

{length;pog}  // 3
{length;{[one;two;three]}} // 3
NameTypeDescription
string_or_arraystring | any[]

{isSnowflake lax return_id;target}

Determines whether the target string is a snowflake.

NameTypeDefaultDescription
targetstringThe string to check
laxbooleanfalseWhether to see if the string contains any snowflakes
return_idbooleanfalseWhether to return the matched snowflake, useful in combination with lax
{isSnowflake;111372124383428608}  // true
{isSnowflake;hello} // false
{isSnowflake;123098123} // false
{isSnowflake lax=true; hello 355876124779347968} // true
{isSnowflake lax=true return_id=true;<@111372124383428608>} // 111372124383428608

{snippet maxLength suffix extra;target}

Create a snippet of a string, truncating it if it is over the max length.

NameTypeDefaultDescription
targetstringThe string to create a snippet of
maxLengthnumber100The maximum length of the snippet
suffixstringThe string to append to the end of the string was truncated
extrastringAdditional information that is appended to the output regardless of whether it was truncated or not

{settings;pluginCode;settingsKey}

Note

This tag is part of the General expensive group.

Get a settings value from a plugin. This tag is intended mostly for internal use and as such there is no official list of all the settings keys available.

NameTypeDescription
pluginCodestringThe code of the plugin to get settings of, for example suggestions
settingsKeystringThe settings key to get, for example anonymousSuggestions would check if the bot should make suggestions anonymous for the suggestions plugin

{find case_insensitive return_all;target;pattern}

Finds pattern in target and returns the first match or all matches if specified. Regular expressions are supported.

NameTypeDefaultDescription
targetstringThe string to search
patternstringThe string or regex pattern to find
case_insensitivebooleantrueWhether the search should ignore case or not. Is incompatible with regex; use the flag i instead
return_allbooleanfalseWhether to return an array of all matches or only the first one. Cannot be used without /regex/g
{find;hello world;hello}     // hello
{find;hello world;nothing}
{find case_insensitive=false;hello world;HELLO} // HELLO
{find;hello world;/hello/i} // hello
{find return_all=true;hello hello hello world;/hello/ig} // {[hello;hello;hello]}

{replace replace_all case_insensitive;target;pattern;replacement}

Replaces matches of pattern in target by replacement. Regular expressions are supported.

NameTypeDefaultDescription
targetstringThe string to search
patternstringThe string or regex pattern to find
replacementstringThe string to put in place of the pattern
replace_allbooleantrueWhether to replace all matches or only the first one. Is incompatible with regex; use the flag g instead
case_insensitivebooleantrueWhether the search should ignore case or not. Is incompatible with regex; use the flag i instead
{replace replace_all=false;hello hello;hell;hey}  // heyo hello
{replace;hello hello;hell;hey} // heyo heyo
{replace;hello hello;/hell/;hey} // heyo hello
{replace;hello hello;/hell/g;hey} // heyo heyo

{sleep;duration}

Note

This tag is part of the Stall expensive group.

Holds up processing. This does not schedule execution for later, it pauses execution until the sleep duration is up. You should only use this in very specific cases and avoid it entirely if possible.

NameTypeDescription
durationnumberHow long in seconds to sleep for

{math precision_fix;expr}

Evaluates math. precision_fix enables a hack that fixes floating point precision errors, but may cause issues in very specific circumstances. Realistically nothing you do with actions should require disabling precision_fix.

Valid operators are +, -, *, /, %, &, |, and ^ Valid functions are sqrt, log, sin, cos, tan, sign, round, floor, ceil, and abs

NameTypeDefaultDescription
exprstringThe math expression to evaluate
precision_fixbooleantrueWhether floating point precision errors should be obfuscated

{random length return_array;haystack}

Gets a random item from a list. length is the number of items to return. When length is true, you can choose to return the random items in an array with return_array.

NameTypeDefaultDescription
haystackstring | any[]
lengthnumber1
return_arraybooleanfalse
{random;123}           // 2
{random;{[1;2;3]}} // 1
{random length=2;123} // 21
{random length=2 return_array=true;123} // {[2;1]}

{fetch;link}

Note

This tag is part of the Stall expensive group.

Performs a HTTP request to a URL.

application/json will be parsed as JSON. application/xml, text/xml, application/rss+xml and application/atom+xml will be parsed as XML.

{=data;{fetch;https://atlas.bot/api/status}}\n{$data.body.ok}  // true
NameTypeDescription
linkstring

{or boolean;...}

Gets the first parameter that is not empty or falsy. The boolean option can be used to return a boolean instead of the first valid value.

{or;;two}       // "two"
{or;;} // no output
{or;false;two} // "two"
{or;one;two} // "one", "two" is never evaluated
{or boolean;one;two} // true
{or boolean;;} // false
NameTypeDefaultDescription
booleanbooleanfalse

{and boolean;...}

Ensures all parameters are present, returning the last parameter if all are valid. The boolean option can be used to return a boolean instead of the last parameter if all are valid.

{and;;two}     // no output, "two" is never evaluated
{and;one;two} // "one", "two" is evaluated
{and;;} // no output
{and boolean;one;two} // true
{and boolean;one;} // false
NameTypeDefaultDescription
booleanbooleanfalse

{formatNumber;number;ordinal}

Formats a number. Formats using the context locale if possible (for example, the guild language).

{formatNumber;1000.5} // 1,000.5
{formatNumber;1000.5} // 1 000,5 depending on the server locale
{formatNumber;420;true} // 420th
NameTypeDefaultDescription
numbernumberThe number to format
ordinalbooleanfalseWhether to format the number as an ordinal

{if}

Compares different values and executes instructions based on the result. Syntax is {if;condition;run_if_true;run_if_false}. condition is either a boolean or a comparison with two elements and an operator.

The available operators are ==, ===, !=, !==, >, >=, <, <=, startswith, endswith, contains, includes, has and matches.

// "==" is used for case-insensitive comparison
{if;word;==;WORD;yay;nay} // yay

// "===" is for case-sensitive comparison
{if;word;===;WORD;yay;nay} // nay

// "matches" can be used for matching regex
{if;word;matches;/[a-z]+/gu;yay;nay} // yay

// Boolean-like values are coerced to booleans before comparison
{if;true;===;yes;yay;nay} // yay

// Numbers are compared as numbers
{if;5;<;10;yay;nay} // yay

// Conditional parsing is used, so in this example only "yay" is ever sent.
// This is an exception instead of a rule as most other tags will parse all parameters regardless.
{if;true;{channel.send;yay};{channel.send;nay}} // yay

{break}

Breaks for-loops early. In this example, only the first item would ever be output.

{=array;{[one;two;three]}}
[#for;{=item};{$array}]
{$item}
{break}
[/for]

{throw;message}

Throws an engine error. Depending on your action setup, these will be shown to the user and logged just as regular engine errors would be.

NameTypeDescription
messagestringMust provide a message to throw

{catch;body;message}

Catches a thrown error.

{catch;{throw;Test error};Oh no! Something went wrong}  // Oh no! Something went wrong
{catch;{throw;Oopsy poopsy!}}
{catch;{user.id}} // 111372124383428608

{repeat;str;times}

Repeats a string a given number of times.

{repeat;Hello;3} // HelloHelloHello
NameTypeDescription
strstringThe string to repeat
timesnumberThe number of times to repeat the string

{return}

Used to return early or to return rich data that may be butchered otherwise. Can be used in functions and the top-level scope. See more in the returning or functions sections.

{void;...}

Used to void the output of its children.

Hello {void;World} // "Hello "

{randomInt;min;max}

Get a random number between min and max. If max is not specified, min is used as the maximum and 0 is used as the minimum.

NameTypeDescription
minnumberThe minimum value
maxnumberThe maximum value

{isUrl;input}

Determine if input is a valid URL. This will not query the domain to see if it is registered, but it will check for a valid protocol and top-level domain.

NameTypeDescription
inputstringThe string to check

{slice;target;start;end}

Get a slice of an array or string. If end is not specified, it is assumed to be the length of the target.

{=array;{[one;two;three]}}
{slice;{$array};1} // {[two;three]}
{slice;{$array};1;2} // {[two]}
NameTypeDescription
targetstring | any[]
startnumber
endnumber

{randomString;length;alphabet}

Generate a random string.

NameTypeDefaultDescription
lengthnumberThe length of the string
lengthnumbera-zA-Z0-9The alphabet to pick from

{import;scriptId}

Note

This tag is part of the Import expensive group.

Import a script action. View more information on the imports page.

// In the script
[#function;my_function]
Hello World!
[/function]
// In another action
{import;action/6c306503-adaf-48ae-b724-40b78d0edd28}
{my_function} // "Hello World!"
// Using a named action
{import;action/My Action}
{my_function} // "Hello World!"
NameTypeDescription
scriptIdstringThe ID or name of the script action to import.

{encodeURIComponent;input}

Encodes text using encodeURIComponent.

NameTypeDescription
inputstringThe string to encode

{decodeURIComponent;input}

Encodes text using decodeURIComponent.

NameTypeDescription
inputstringThe string to decode

{encodeBase64;input}

Encodes text to base64.

NameTypeDescription
inputstringThe string to encode

{decodeBase64;input}

Decodes text from base64.

NameTypeDescription
inputstringThe string to decode

{range;startOrStop;stop;step}

Creates a range of numbers.

This tag generates an array of numbers starting from startOrStop up to (but not including) stop, with a step size of step. If stop is not provided, startOrStop is interpreted as the stop value and the start is set to 0. If step is not provided, the step size defaults to 1 if start is less than stop, and -1 if start is greater than stop.

{range;10;20;2}
NameTypeDescription
startOrStopnumberThe start of the range or the stop value if no 'start' is provided
stopnumberThe end of the range
stepnumberThe step size

Limitations

  • The maximum number of numbers in the range is 5000.
  • start and stop must be valid numbers.
  • step must be a non-zero number.

{limits;tier}

Gets the limits for the current server. These are things like the amount of actions you can have, which plugins you can use, etc. The output from this is not guaranteed to be stable, use at your own risk!

NameTypeDescription
tierstringThe tier to get the limits for. Defaults to the current server's tier