Home Features FAQ Docs Support
Command Store Premium

Custom Commands

Build your own text commands, right from the dashboard or with these slash commands - no coding needed. The full guide, including the {variable} reference and live examples, is below.

Command Description Parameters Required Permission
/cmd add
Creates a new custom command.
  • name Required

    The trigger name, up to 18 characters.

  • code Required

    What the bot will say or do, up to 750 characters.

Administrator
/cmd delete
Deletes an existing custom command, with a confirmation step that automatically expires after 15 seconds.
  • name Required

    The command to delete.

Administrator
/cmd show
Displays the underlying code of an existing command.
  • name Required

    The command whose code you want to see.

Administrator
/cmd all
Lists every custom command on the server. - Administrator

Good to know

  • Limit: up to 15 custom commands on regular servers, and up to 30 on Premium servers.

How Custom Commands Work

A custom command has a trigger (the text that activates it) and a response (what the bot sends back). The response can include special {variable} placeholders and {function(...)} calls that NexusBot evaluates live, such as user info, random numbers, saved data, and conditional logic.

Trigger name

The word or phrase that activates the command, e.g. "hi" or "!hello".

Text match type

Controls how the trigger is matched inside a message: "start" (message starts with the trigger), "anywhere" (trigger appears anywhere in the text), or "end" (message ends with the trigger).

Cooldown (seconds)

How many seconds a user must wait before they can use this command again.

Direct reply

When enabled, the bot replies to (tags) the triggering message instead of sending a plain new message.

Cooldown alert

When enabled, the bot sends an error message if a user tries to use the command while it's still on cooldown.

Variables & Functions Reference

These placeholders can be used anywhere inside a command's response. They are evaluated by NexusBot when the command runs. This is the same reference list shown live inside the dashboard's command editor (press Ctrl+Space, or just type { and start typing).

User & Mentions

Variable Example Description
{user} {user} Returns the complete user object.
{username} {username} Returns the username of the command executor.
{user.id} {user.id} Returns the Discord ID of the user.
{user.tag} {user.tag} Returns the user's Discord tag/discriminator.
{avatar} {avatar} Returns the user's avatar image URL.
{mention} {mention} Mentions the user or returns 'null' if missing.
{mention.id} {mention.id} Returns the ID of the mentioned user.
{mention.name} {mention.name} Returns the name of the mentioned user.
{mention.avatar} {mention.avatar} Returns the avatar URL of the mentioned user.

Arguments & Text

Variable Example Description
{args} {args} Returns all text arguments provided after the command trigger.
{args(N)} {args(1)} Returns the Nth argument (e.g., first argument).
{args(N-M)} {args(1-3)} Returns a range of arguments from position N to M.
{args.length} {args.length} Returns the total character length of the arguments.
{upper(text)} {upper(text)} Converts the targeted text to UPPERCASE.
{lower(text)} {lower(text)} Converts the targeted text to lowercase.
{length(text)} {length(text)} Returns the length of the specified text.
{reverse(text)} {reverse(text)} Reverses the character sequence of the text.
{contains(t,s)} {contains(text,search)} Checks if text 't' contains substring 's'. Returns true/false.
{startswith(t,s)} {startswith(text,search)} Checks if text 't' starts with substring 's'. Returns true/false.
{endswith(t,s)} {endswith(text,search)} Checks if text 't' ends with substring 's'. Returns true/false.
{urlencode(text)} {urlencode(text)} Encodes text into a valid URL format.
{urldecode(text)} {urldecode(text)} Decodes a URL-encoded string back to plain text.
{br} {br} Inserts a line break / new line into the output.

Save, Load & Database

Variable Example Description
{save[id][key](val)} {save[money][{user.id}](100)} Saves a value into the database for a specific ID and key.
{load[id][key]} {load[money][{user.id}]} Loads data from the database. Returns '0' if the path is empty.
{load[id].list(sep)} {load[money].list(,)} Lists keys inside the ID path, separated by the given separator.
{load[id].list.count} {load[money].list.count} Returns the total number of entries under this ID.
{load[id].list.random} {load[money].list.random} Selects a random key from the database list.
{load[id].list.first} {load[money].list.first} Returns the first key in the collection.
{load[id].list.last} {load[money].list.last} Returns the last key in the collection.
{load[id].top(N, sep)} {load[money].top(5, \n)} Returns the top N highest values, ranked, with a custom separator.
{load[id].values(sep)} {load[money].values(,)} Returns all stored values joined by a separator.
{load[id].values.sum} {load[money].values.sum} Calculates the sum of all values in this collection.
{load[id].values.avg} {load[money].values.avg} Calculates the average of all values in the collection.
{load[id].values.max} {load[money].values.max} Finds and returns the maximum value in the collection.
{load[id].values.min} {load[money].values.min} Finds and returns the lowest numeric value in the collection.
{load[id].sort.asc(sep)} {load[money].sort.asc(\n)} Returns database values sorted in ascending order.
{load[id].sort.desc(sep)} {load[money].sort.desc(\n)} Returns database values sorted in descending order.
{load[id].filter.greater(X,sep)} {load[money].filter.greater(50,,)} Filters database keys holding values greater than X.
{load[id].filter.less(X,sep)} {load[money].filter.less(50,,)} Filters database keys holding values less than X.
{load[id].has(key)} {load[money].has({user.id})} Checks if a specific key exists. Returns true/false.
{load[id].exists} {load[money].exists} Checks if the entire database ID cluster exists.
{load[id].find(val)} {load[money].find(100)} Searches for a specific value and returns its matching key.
{load[id].rank(key)} {load[money].rank({user.id})} Returns the leaderboard rank of a key based on its value.

Conditions

Variable Example Description
{tr(cond)[txt]} {tr({load[money][{user.id}]} > 10)[Show Text]} Inline shorthand condition. Renders the text block only if the condition is true.
{if(cond)[T][F]} {if({load[money][{user.id}]} != 0)[Has Data][No Data]} Advanced conditional branching block. Needs a matching closure.
{crole(roleId)} {crole(123456789)} Checks if the command executor has the specified role ID. Returns true/false.

Math

Variable Example Description
{m(expr)} {m(5+5*2)} Evaluates an expression and prints only the final numeric result.
{math(expr)} {math(10/2)} Evaluates and outputs the full expression string alongside the result.
{abs(x)} {abs(-5)} Returns the absolute (positive) value of a number.
{round(x)} {round(4.6)} Rounds a decimal value to the nearest integer.
{floor(x)} {floor(4.9)} Rounds a decimal number downwards.
{ceil(x)} {ceil(4.1)} Rounds a decimal number upwards.
{min(a,b)} {min(10,20)} Returns the lower value between two numbers.
{max(a,b)} {max(10,20)} Returns the higher value between two numbers.

Random & Variables

Variable Example Description
{N-M} {1-100} Generates a random integer within the inclusive range of N to M.
{opt(a,b,c)} {opt(Yes,No,Maybe)} Selects a random choice from the comma-separated options.
{ruser} {ruser} Selects a completely random user object from the server.
{ruser.id} {ruser.id} Returns the Discord user ID of a randomly selected server member.
{emoji.random} {emoji.random} Picks a random custom emoji available in the guild.
{var[nm][val]} {var[x][10]} Declares a local temporary execution variable.
$name {$x} Retrieves the value of a temporary variable. Returns 'null' if empty.

Time & Date

Variable Example Description
{date} {date} Returns the current calendar date.
{time} {time} Returns the current server time (24h format).
{time12} {time12} Returns the current server time (12h AM/PM format).
{day} {day} Returns the current numeric calendar day.
{month} {month} Returns the current numeric calendar month.
{timestamp} {timestamp} Returns the current Unix epoch timestamp.
{yyyy} {yyyy} Returns the current four-digit year.
{mm} {mm} Returns the current padded numeric month.
{dd} {dd} Returns the current padded numeric day.
{joined} {joined} Returns the date the user joined the server.
{joined(time)} {joined(time)} Returns the relative time since the user joined the server.
{created} {created} Returns the user's Discord account creation date.
{account.age} {account.age} Returns the number of days since the user created their Discord account.

Server, Channels & Roles

Variable Example Description
{guild} {guild} Returns the current server's name.
{guild.id} {guild.id} Returns the unique Discord ID of the current server.
{guild.owner} {guild.owner} Mentions or returns the ID of the server owner.
{guild.created} {guild.created} Returns the server's creation date.
{guild.boost} {guild.boost} Returns the current premium boost tier of the server.
{guild.boosts} {guild.boosts} Returns the total number of boosts on the server.
{count} {count} Returns the total member count of the server.
{channel.id} {channel.id} Returns the current channel's ID.
{channel.name} {channel.name} Returns the current channel's name.
{channels.count} {channels.count} Returns the total number of channels in the server.
{channels.text} {channels.text} Returns the total number of text channels.
{channels.voice} {channels.voice} Returns the total number of voice channels.
{roles} {roles} Lists all roles configured in the server.
{roles.count} {roles.count} Returns the total number of roles in the server.
{roles.total} {roles.total} Alternative alias for the total role count.

Messages & Emojis

Variable Example Description
{message.id} {message.id} Returns the ID of the message that triggered the command.
{message.link} {message.link} Generates a jump URL link to the source message.
{delete} {delete} Deletes the user's trigger message.
{pin} {pin} Pins the bot's response in the current channel.
{emoji.count} {emoji.count} Returns the total number of custom emojis in the server.

Lists

Variable Example Description
{list.first} {list.first} Extracts the first element of a list result.
{list.last} {list.last} Extracts the last element of a list result.
{list.random} {list.random} Extracts a random element from a list result.
{list.join(sep)} {list.join(-)} Joins list elements into a single text output using a separator.

Examples

A simple welcome reply

trigger: hi match: start
Hey {mention}, welcome to {guild}! You are member #{count}. 🎉

Replies to anyone who sends a message starting with "hi", mentioning them and showing the server name and member count.

A coin flip command

trigger: flip match: start
🪙 {opt(Heads,Tails)}!

{opt(a,b,c)} picks one option at random out of a comma-separated list, giving a 50/50 coin flip.

Saving and reading a value

trigger: setmoney match: start
{save[money][{user.id}](100)}Your balance is now {load[money][{user.id}]} coins.

{save[id][key](val)} writes a value to NexusBot's per-server database, and {load[id][key]} reads it back. Here "money" is the database ID and the user's Discord ID is the key, so every user gets their own balance.

A conditional response

trigger: balance match: start
{if({load[money][{user.id}]} != 0)[You have money saved!][You have nothing saved yet.]}

{if(condition)[if true][if false]} branches the response based on a condition, here checking whether the user has a saved balance.