Custom messages allow you to configure your own text to send to users for things such as supporter announcements or welcome messages. They are also used for stats channels. In addition to writing static text, you can also set up dynamic text that changes depending on certain variables.
This guide goes over the mechanics of dynamic custom messages and not how to write a good one; that is up to your personal style.
The basic format for dynamic custom messages is to simply insert a command block into the message using {...}
.
For example, to mention the user in a welcome message, simply do {mention}
.
There are also commands that take and manipulate other values. For example, to show "you are the Nth member", you can do {ordinal {members}}
to get the "Nth". Here, ordinal
is a function that takes a number and returns the ordinal format ("Nth") for it, and members
is a function that returns the number of members in the server at the time.
To insert a literal {
, just write \{
.
If the context targets a server member (e.g. welcome messages), the following are available:
{avatar}
: the user's server-specific avatar if present, their user avatar otherwise{nickname}
: the member's nickname if they have one and their display name othewise{booster?
: whether or not the member is boosting the serverIf the context targets a server member (e.g. welcome messages) or a user, the following are available:
{mention}
: mention the user — note that this only pings if in the message content and not in an embed{display-name}
: the user's display name{username}
: the user's username{tag}
: the user's tag, which is their username in the new system and username#NNNN
in the old system{discriminator}
: the user's discriminator, which is "0"
in the new system and the four numbers at the end of their tag in the old system (as a string){banner}
: the user's banner URL (unfortunately, there is no way to get a member's server-specific banner for some reason){bot?}
: whether the user is a bot{user-avatar}
: the user's global avatar (ignores their server profile)If the context targets a role (e.g. supporter announcements), the following are available:
{role-icon}
: the role's icon URL{role-members}
: the number of members with the role{role-name}
: the role's name{hoist?}
: whether or not the role is hoisted (displays members with the role separately on the member list)If the context targets a server (always), the following are available:
{server}
: the server's name{members}
: the number of members in the server{boosts}
: the number of boosts (not the number of boosting members){tier}
: the server's boost tier (0, 1, 2, or 3){server-icon}
: the server's icon URL{server-banner}
: the server's banner URL{server-splash}
: the server's discovery splash image URL{bots}
: the number of bots in the server{humans}
: the number of non-bot members in the server{boosters}
: the number of boosting members (not the number of boosts)The following functions are globally available to manipulate the values. Most values are strings (text), but some are numbers and yes/no values are represented as 0
for false and 1
for true.
Note that these may be confusing to people who have no experience with programming. For the most part, you do not need to use these. The most important ones are ?
(as it allows you to switch between different messages for different occasions), random
, and ordinal
.
Arguments surrounded by []
are optional. ...
indicates that an arbitrary number of arguments are allowed.
{? a b [c]}
: if a is true-like (non-empty string or non-zero number), returns b, and otherwise returns c (or "" if c is missing){!= ...}
: returns 1 if all provided values are unique and 0 otherwise (at least 2 values){random ...}
: randomly choose one of the given values (least 1 value){list ...}
: create a list from the provided values{! x}
: returns 1 if x is false-like (empty string or 0) and 0 otherwise{length x}
: returns the length of a list{ordinal #}
: s the "Nth" form of a number (1st, 2nd, 3rd, etc.) (works for negative numbers){join x y}
: returns the values in list x as strings joined on string y{+ ...}
: returns the sum of a list of values, converting into numbers (at least 1 value){- ...}
: chain subtraction; {- x y z}
is x - y - z, converting into numbers (at least 1 value){* ...}
: returns the product of a list of values, converting into numbers (at least 1 value){/ ...}
: chain division; {/ x y z} is x / y / z
(at least 1 value){ ...}
: chain floor division; {5 2}
returns 2 and not 2.5 (at least 1 value){# x}
: returns the length of a list{# ...}
: index access; {# w x y z}
is equivalent to a[b][c][d]{% ...}
: chain modulo (remainder after division); e.g. </>{% 7 3} is 1
(at least 1 value){^ ...}
: chain exponentiation; e.g. {^ x y z}
is (x ^ y) ^ z (at least 1 value){&& ...}
: logical AND (return the first false-like value or the last value if all are true-like) (at least 1 value){|| ...}
: logical OR (return the first true-like value or the last value if all are false-like) (at least 1 value){++ ...}
: concatenate lists together (at least 1 value){= ...}
: returns 1 if all provided values are equal and 0 otherwise (at least 1 value){> ...}
: returns 1 if all provided values are in strictly descending order and 0 otherwise (at least 1 value){>= ...}
: returns 1 if all provided values are in non-increasing order and 0 otherwise (at least 1 value){< ...}
: returns 1 if all provided values are in strictly increasing order and 0 otherwise (at least 1 value){<= ...}
: returns 1 if all provided values are non-decreasing order and 0 otherwise (at least 1 value)You can also insert values into functions. To include a number, just enter the number. To include a string, surround it with quotes. Both "..."
and '...'
work the same way. If you wish to include the same type of quotes within the string, escape them like so: "hello \" world"
.