Getting started
Variables in replies
Put names, numbers and server info in a reply with curly brackets.
A variable is a name in curly brackets, like {user.mention}. When the command runs, the bot puts the real value in its place.
Hello {user.mention}! There are {server.member_count} members here.Becomes:
Hello @Alex! There are 1,204 members here.Variables work in the Content / Reply Message box and in embeds used as the reply.
The person who ran the command#
| Variable | What it shows |
|---|---|
{user.mention} | A ping, like @Alex |
{user.display_name} | Their name in this server |
{user.username} | Their Discord username |
{user.id} | Their user ID |
{user.avatar_url} | A link to their avatar |
{user.top_role} | Their highest role |
{user.unix_joined_at} | When they joined, as a number for timestamps |
The server#
| Variable | What it shows |
|---|---|
{server.name} | The server name |
{server.member_count} | How many members |
{server.icon_url} | A link to the server icon |
{server.owner.mention} | A ping of the owner |
{server.premium_subscription_count} | Number of boosts |
The channel#
| Variable | What it shows |
|---|---|
{channel.mention} | A link to the channel, like #general |
{channel.name} | The channel name |
{channel.id} | The channel ID |
For every field, see Objects.
Arguments#
Every argument you add to a command becomes a variable with the same name.
Add a Member argument named target. Then:
{user.mention} gave a cookie to {target.mention}!A Text argument named reason is plain text:
Reason: {reason}Watch out
An argument hides anything with the same name. An argument named user replaces the person who ran the command. Pick a different name, like member or target.
Values from your code#
Anything you make in the Pre-hook can go in the reply.
coins = int(member_var("coins", 0))You have {coins} coins.You can also do small sums inside the brackets. With an Integer argument named age:
Next year you will be {age + 1}.If something inside the brackets fails, it shows as None instead of breaking the command.
Saved values#
Some values should stay after the command ends, like coins or a counter. Save them with server or member variables:
update_member_var("coins", 100)See Saving data.
In events#
Events have no reply box, so curly-bracket variables do not work there. Build the text in code with an f-string instead:
send_message("welcome", f"Welcome {user.mention} to {server.name}!")