Tags
Global
{option;name}
Get the value of a defined option.
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"
Name | Type | Description |
---|---|---|
name | string | The name of the option to get |
{time format to;time}
Formats time as a string. Is compatible with any of the .createdAt
tags.
Name | Type | Default | Description |
---|---|---|---|
time | Time | context Date | The time we should format. Defaults to the current time. Can be a relative time or various date formats. |
format | TimestampStylesString | The format to use. If left out, we return the current unix time instead. | |
to | string | The 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 caseupper
THIS IS UPPER CASEfirst
This is first casetitle
This Is Title Casecamel
thisIsCamelCaseconstant
THIS_IS_CONSTANT_CASEmocking
tHiS iS mOcKiNg CaSe
Name | Type | Description |
---|---|---|
mode | CasingMode | The case to transform the input to |
input | string | The 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
Name | Type | Description |
---|---|---|
string_or_array | string | any[] |
{isSnowflake lax return_id;target}
Determines whether the target string is a snowflake.
Name | Type | Default | Description |
---|---|---|---|
target | string | The string to check | |
lax | boolean | false | Whether to see if the string contains any snowflakes |
return_id | boolean | false | Whether 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.
Name | Type | Default | Description |
---|---|---|---|
target | string | The string to create a snippet of | |
maxLength | number | 100 | The maximum length of the snippet |
suffix | string | … | The string to append to the end of the string was truncated |
extra | string | Additional information that is appended to the output regardless of whether it was truncated or not |
{settings;pluginCode;settingsKey}
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.
Name | Type | Description |
---|---|---|
pluginCode | string | The code of the plugin to get settings of, for example suggestions |
settingsKey | string | The 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.
Name | Type | Default | Description |
---|---|---|---|
target | string | The string to search | |
pattern | string | The string or regex pattern to find | |
case_insensitive | boolean | true | Whether the search should ignore case or not. Is incompatible with regex; use the flag i instead |
return_all | boolean | false | Whether 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.
Name | Type | Default | Description |
---|---|---|---|
target | string | The string to search | |
pattern | string | The string or regex pattern to find | |
replacement | string | The string to put in place of the pattern | |
replace_all | boolean | true | Whether to replace all matches or only the first one. Is incompatible with regex; use the flag g instead |
case_insensitive | boolean | true | Whether 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}
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.
Name | Type | Description |
---|---|---|
duration | number | How 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
Name | Type | Default | Description |
---|---|---|---|
expr | string | The math expression to evaluate | |
precision_fix | boolean | true | Whether 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
.
Name | Type | Default | Description |
---|---|---|---|
haystack | string | any[] | ||
length | number | 1 | |
return_array | boolean | false |
{random;123} // 2
{random;{[1;2;3]}} // 1
{random length=2;123} // 21
{random length=2 return_array=true;123} // {[2;1]}
{fetch;link}
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
Name | Type | Description |
---|---|---|
link | string |
{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
Name | Type | Default | Description |
---|---|---|---|
boolean | boolean | false |
{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
Name | Type | Default | Description |
---|---|---|---|
boolean | boolean | false |
{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
Name | Type | Default | Description |
---|---|---|---|
number | number | The number to format | |
ordinal | boolean | false | Whether 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.
Name | Type | Description |
---|---|---|
message | string | Must 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
Name | Type | Description |
---|---|---|
str | string | The string to repeat |
times | number | The 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.
Name | Type | Description |
---|---|---|
min | number | The minimum value |
max | number | The 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.
Name | Type | Description |
---|---|---|
input | string | The 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]}
Name | Type | Description |
---|---|---|
target | string | any[] | |
start | number | |
end | number |
{randomString;length;alphabet}
Generate a random string.
Name | Type | Default | Description |
---|---|---|---|
length | number | The length of the string | |
length | number | a-zA-Z0-9 | The alphabet to pick from |
{import;scriptId}
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!"
Name | Type | Description |
---|---|---|
scriptId | string | The ID or name of the script action to import. |
{encodeURIComponent;input}
Encodes text using encodeURIComponent.
Name | Type | Description |
---|---|---|
input | string | The string to encode |
{decodeURIComponent;input}
Encodes text using decodeURIComponent.
Name | Type | Description |
---|---|---|
input | string | The string to decode |
{encodeBase64;input}
Encodes text to base64.
Name | Type | Description |
---|---|---|
input | string | The string to encode |
{decodeBase64;input}
Decodes text from base64.
Name | Type | Description |
---|---|---|
input | string | The 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}
Name | Type | Description |
---|---|---|
startOrStop | number | The start of the range or the stop value if no 'start' is provided |
stop | number | The end of the range |
step | number | The step size |
Limitations
- The maximum number of numbers in the range is 5000.
start
andstop
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!
Name | Type | Description |
---|---|---|
tier | string | The tier to get the limits for. Defaults to the current server's tier |