Functions
Every function you can call inside {{ … }}, by category. See Expressions for how the language works. The results below are computed by Tsuaa itself, with 15 January 2026 at 14:30 UTC as the current time and English (US) as the server's language.
Values
default(value, fallback)
The value, or the fallback when the value is empty (missing, empty text or empty list). The fallback is only evaluated when used.
default("", "friend") — Gives friend
if(condition, then, otherwise)
The second value when the condition is true, the third otherwise. Only the returned one is evaluated.
if(3 > 2, "big", "small") — Gives big
is_empty(value)
True when the value is missing, an empty text or an empty list.
is_empty([]) — Gives true
number(value)
Turns a text holding a number into a number. Fails on a text that isn't one.
number("42") + 1 — Gives 43
text(value)
The value in its text form: a number or a date formatted in the server's language, a list joined with commas.
length(text(12345)) — Gives 5
Numbers
round(number, [decimals])
Rounds a number, to a number of decimals if given (up to 10).
round(3.14159, 2) — Gives 3.14
floor(number)
Rounds a number down.
floor(4.7) — Gives 4
ceil(number)
Rounds a number up.
ceil(4.2) — Gives 5
abs(number)
A number without its sign.
abs(-7) — Gives 7
min(number, …)
The smallest of the numbers.
min(4, 9, 2) — Gives 2
max(number, …)
The largest of the numbers.
max(4, 9, 2) — Gives 9
clamp(number, min, max)
The number, kept between a minimum and a maximum.
clamp(120, 0, 100) — Gives 100
pow(number, power)
A number raised to a power.
pow(2, 10) — Gives 1024
sqrt(number)
The square root of a number.
sqrt(81) — Gives 9
random(min, max)
A random whole number between two bounds, both included.
random(1, 6) — Gives 4
format_number(number)
A number written the way the server's language writes it, with thousands separators.
format_number(1234567.5) — Gives 1,234,567.5
Text
upper(text)
The text in capital letters.
upper("hello") — Gives HELLO
lower(text)
The text in small letters.
lower("HeLLo") — Gives hello
capitalize(text)
The text with its first letter in capitals.
capitalize("hello world") — Gives Hello world
trim(text)
The text without spaces at its start and end.
trim(" hi ") — Gives hi
length(text or list)
The number of characters of a text, or of items of a list.
length("Tsuaa") — Gives 5
slice(text or list, start, [end])
Part of a text or a list, from a position (0 is the first) up to another, excluded. Negative positions count from the end.
slice("Discord", 0, 4) — Gives Disc
truncate(text, length)
The text cut to a maximum length, ending with … when it was longer.
truncate("A very long title", 10) — Gives A very lo…
replace(text, search, replacement)
The text with every occurrence of a search replaced.
replace("a-b-c", "-", " ") — Gives a b c
contains(text, search)
True when the text contains the search.
contains("Hello there", "there") — Gives true
starts_with(text, start)
True when the text starts with the given start.
starts_with("!help", "!") — Gives true
ends_with(text, end)
True when the text ends with the given end.
ends_with("photo.png", ".png") — Gives true
matches(text, pattern)
True when the text matches a regular expression (at most 500 characters).
matches("abc123", "^[a-z]+[0-9]+$") — Gives true
split(text, separator)
Cuts a text into a list at each separator.
split("red,green,blue", ",") — Gives red, green, blue
repeat(text, times)
The text repeated a number of times.
repeat("ab", 3) — Gives ababab
Dates
now()
The current date and time.
now() — Gives 1/15/26, 2:30 PM
date(value)
Turns an ISO text (2026-01-15T14:30:00Z) or a timestamp in milliseconds into a date.
date("2026-01-15T14:30:00Z") — Gives 1/15/26, 2:30 PM
add(date, amount, unit)
A date moved by an amount of a unit: seconds, minutes, hours, days, weeks, months or years. A negative amount goes back.
add("2026-01-15T14:30:00Z", 1, "months") — Gives 2/15/26, 2:30 PM
diff(date, other date, unit)
The number of whole units from the second date to the first.
diff("2026-03-01", "2026-01-15", "days") — Gives 45
since(date, unit)
The number of whole units elapsed since a date.
since("2026-01-01", "days") — Gives 14
discord_time(date, [style])
A date Discord shows in each reader's own time zone and language. Styles: relative, date, long_date, time, datetime, full (by default).
discord_time("2026-01-15T14:30:00Z", "relative") — Gives <t:1768487400:R>
format_date(date, [style])
A date written in the server's language, in UTC. Styles: date, long_date, time, datetime (by default), full.
format_date("2026-01-15T14:30:00Z", "long_date") — Gives January 15, 2026
timestamp([date])
A date as milliseconds since 1 January 1970; the current time without a date.
timestamp("2026-01-15T14:30:00Z") — Gives 1768487400000
Lists
join(list, [separator])
The items of a list joined into one text, with a separator (a comma and a space by default).
join(["a", "b", "c"], " / ") — Gives a / b / c
first(list)
The first item of a list, or empty.
first(["a", "b", "c"]) — Gives a
last(list)
The last item of a list, or empty.
last(["a", "b", "c"]) — Gives c
at(list, position)
The item at a position of a list (0 is the first, -1 the last), or empty.
at(["a", "b", "c"], -1) — Gives c
includes(list, value)
True when the list holds the value.
includes(["mod", "admin"], "admin") — Gives true
pick(list)
A random item of a list, or empty.
pick(["rock", "paper", "scissors"]) — Gives paper