> ## Documentation Index
> Fetch the complete documentation index at: https://docs.curebot.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Custom commands

> Build your own commands, buttons and small features from blocks, Scratch-style: replies, roles, variables, lists, games, rewards and functions.

A custom command is your own feature, built from blocks you snap together, like Scratch. It can be as small as a reply to `,hello` or as big as a points game with a leaderboard, buttons and a shop.

![](https://docs.curebot.site/images/showcase-member.png)

in the poolToday at 4:12 PM

,8ball will it rain tomorrow

![](https://docs.curebot.site/images/cure-avatar.jpg)

cureAPPToday at 4:12 PM

🎱 Signs point to yes.

> [!NOTE]
>
> Build them in **Dashboard → Automation → Custom commands**. You need **Automation** access in [dashboard access](https://docs.curebot.site/start/dashboard-access.md). Members use them with your prefix (`,` unless you changed it), and as `/name` when you turn on slash.

## The page

**Custom commands** lists your commands with their description, how many blocks they have and how often they're used. Open one, or press **New command**, and the editor fills the whole window. **Back** returns to the list, and asks first if you have unsaved changes. The link in your address bar (`…/custom-commands?command=hello`) opens the same command, so you can send it to another staff member.

Name a new command with lowercase letters, numbers, `-` and `_`, up to 32 characters. It can start from a template:

![The custom commands list](https://mintcdn.com/cure/JT6OLTifSCrGzVw3/images/screenshots/custom-commands-list.png?fit=max\&auto=format\&n=JT6OLTifSCrGzVw3\&q=85\&s=59828c03d517104f79be635dd61d7aa5)

1 New command, 2 your commands, 3 templates.

| Template | Makes |
| - | - |
| **Say hello** | A friendly reply. The simplest place to start |
| **Rules card** | Your rules in a container with a coloured edge |
| **Apply for staff** | A button that opens one of your [forms](https://docs.curebot.site/studio/buttons-forms.md) |
| **Role button** | A button that gives or takes a role |
| **Magic 8-ball** | Answers a question at random |
| **Suggestions** | Members send an idea; it's posted in a channel you pick |
| **Welcome new members** | Greets everyone who joins |

Each command has five tabs:

| Tab | What's there |
| - | - |
| **Blocks** | The canvas, with every block on the left |
| **Arguments & settings** | What members type after the command, other names, cooldown, who and where |
| **Variables** | Every variable you can use, and every value saved right now |
| **Test** | Runs the blocks without doing anything, and shows what would happen |
| **Guide** | A short guide inside the dashboard |

The **On** switch turns the command on or off without deleting it.

![The custom command editor](https://mintcdn.com/cure/JT6OLTifSCrGzVw3/images/screenshots/custom-commands-editor.png?fit=max\&auto=format\&n=JT6OLTifSCrGzVw3\&q=85\&s=7ae3bbeafb51b944c269e130327c25f7)

1 back to the list, 2 the tabs, 3 every block, 4 the canvas.

## How blocks work

### Scripts and start blocks

The canvas holds **scripts**: stacks of blocks that run top to bottom. A script starts with a **start block** (the rounded one on top), which says *when* it runs. A stack with no start block never runs, so you can keep spare blocks lying around.

| Start block | Runs |
| - | - |
| **When the command is used** | When someone types `,name` (or `/name`). Every command has exactly one. Its arguments are set right on this block |
| **When a message says…** | When any member's message contains, starts with, is exactly, or has the word you set. Optionally in one channel. `{var:content}` is the message |
| **When a member joins** | For every new member. Replies go to the server's system channel |
| **When a member leaves** | When someone leaves. Their roles can't be changed any more |
| **When someone reacts** | When someone adds your emoji to a message, optionally in one channel. React and Delete act on that message |
| **Every few minutes** | Every 10 minutes to every 7 days, as cure, in the channel you pick |
| **Define a function** | When called by name, from a Call block, a button, or a [workflow](https://docs.curebot.site/studio/workflows.md) |

A command can have up to 20 scripts, so one command can hold a whole feature: the command, the buttons it posts, the functions they run and a daily timer.

### Editing the canvas

* **Drag** blocks from the list onto the canvas, under a start block or inside an **If**, **Repeat** or **For each**.
* **Drag** a block by its edge to move it, and everything under it moves too.
* **Right-click** a block or the canvas for duplicate, copy, paste, delete, **Tidy up** and full screen. Each block also has buttons to duplicate it or delete it.
* **Zoom** with the buttons in the corner, or Ctrl and scroll.
* Blocks with problems are marked. Most come with a one-click fix, like "Use `{user.name}`" when you typed `user.name` without the brackets.

### Value blocks

Blocks that work something out (Do maths, Random number, Look up, Join text, True or false, Call a function and others) save their answer in a variable you name, like `{var:roll}`. You can also **drop a value block straight into another block's field**, and its answer is used right there. This is how you put a variable into a field that won't let you type, like a number box.

## Blocks

> [accordion] Messages
>
> | Block | Does |
> | - | - |
> | **Reply** | Answers where it started. Options: **private** (only the member sees it, for slash commands and buttons), **don't ping**, and **delete after** up to 600 seconds |
> | **Say in this channel** | Posts a normal message (not a reply). Safe to use after deleting the command message |
> | **Post in a channel** | Posts in any channel |
> | **Send a DM** | Messages the member, or a member argument. Does nothing if their DMs are closed |
> | **Send an embed** | A card with title, text, colour, images, author, link and time. As a reply, a post or a DM |
> | **Send a saved design** | Sends a design from [Message Studio](https://docs.curebot.site/studio/messages.md) |
> | **Send a container** | A modern card: text with a coloured edge, an image and up to 5 buttons that run functions |
> | **Open a form** | Posts a button that opens one of your saved forms |
> | **Post buttons** | Up to 5 buttons. Each one runs a function as whoever presses it |
> | **React** | Adds a reaction to the message that started it |
> | **Delete the message** | Deletes the message that started it |

> [accordion] Members
>
> | Block | Does |
> | - | - |
> | **Give a role**, **Take a role**, **Toggle a role** | Toggle gives it if they don't have it and takes it if they do. The role must be below cure's highest role |
> | **Change a nickname** | Empty resets it |
> | **Find a member** | From a name, mention, ID or variable, gives their mention, ID or name. Empty if nobody matches |
> | **Time out**, **Remove a time out** | Timing out someone else needs Timeout Members |
> | **Kick**, **Ban** | The person using the command needs Kick Members or Ban Members. Ban can delete up to 7 days of messages |
> | **Move or disconnect from voice** | Needs Move Members |
>
> Member blocks act on **the member using it** by default, or on a member argument (like `target`).

> [accordion] Control
>
> | Block | Does |
> | - | - |
> | **If … else** | Runs the top part when the condition is true, otherwise the bottom part |
> | **Repeat** | Runs the blocks inside up to 25 times. `{var:loop}` is the round |
> | **Repeat until** | Keeps going until the condition is true, 25 rounds at most |
> | **For each item in a list** | Once per item. `{var:item}` is the item, `{var:index}` its position |
> | **Wait** | Pauses, up to 15 seconds in total per run |
> | **Stop** | Ends the run here |
> | **Note to self** | Does nothing. Explains your blocks to the next person |

> [accordion] Sensing
>
> | Block | Does |
> | - | - |
> | **Ask and wait** | Asks a question and waits up to 60 seconds for the member's next message. Up to 3 per run |
> | **Make a timestamp** | A Discord timestamp that shows in each reader's own time zone, like "in 2 hours". From now, a date you pick, or any text, moved by an amount, in any style |
> | **Look up** | Saves a fact about a member (name, ID, days since joining, account age, roles, boosting…), the server (members, boosts, channels…) or the time (UTC) |

> [accordion] Variables and lists
>
> | Block | Does |
> | - | - |
> | **Set a variable** | Sets one, for this run, the server or the member |
> | **Change a variable by** | Adds a number (a negative one subtracts). Empty counts as 0 |
> | **Variable** | Gives a variable's value, to drop into a field |
> | **Change a list** | Add, insert, replace, remove, clear, shuffle, sort, or remove repeats. Lists hold 100 items |
> | **Read from a list** | An item, the length, a random item, where an item is, or everything joined |

> [accordion] Operators
>
> | Block | Does |
> | - | - |
> | **Join text** | Puts pieces of text together |
> | **True or false** | Checks a condition and gives true or false |
> | **Do maths** | Add, subtract, multiply, divide, remainder, power, round, absolute and square root |
> | **Random number** | A whole number between two, both included |
> | **Pick at random** | One of your options |
> | **Work with text** | Change case, length, a letter or word, replace, contains, slice and more |

> [accordion] Rewards and games
>
> | Block | Does |
> | - | - |
> | **Give or take points** | Activity points, the ones members spend in `,rewards` |
> | **Give or take coins** | The economy balance, the same as `,balance` |
> | **Read points, coins or level** | Saves a member's stat to compare or show |
> | **Give a title** | Unlocks a title shown in `,rewards` |
> | **Flip a coin**, **Roll dice** | Heads or tails; up to 20 dice with 2 to 1,000 sides. Each roll is in `{var:rolls}` |
> | **Pick a random member** | Optionally only people with a role. For raffles and games |
> | **Leaderboard** | Ranks members by a member variable, like `{mvar:wins}`, as a numbered list |

> [accordion] Functions
>
> | Block | Does |
> | - | - |
> | **Call a function** | Runs a function in this command, or `other.function` in another, with up to 3 inputs |
> | **Return a value** | Ends a function and gives a value back. It's `{var:result}` after the Call, or drop the Call block into a field |
> | **Run another command** | Runs another custom command's main blocks |

### Conditions

**If**, **Repeat until** and **True or false** check a condition:

| Condition | True when |
| - | - |
| **Compare two values** | Equal, not equal, more, less, at least, at most, contains, starts with. Numbers compare as numbers |
| **An argument** | Argument 1 to 10 is given, equals or contains something |
| **A variable** | It's set, equals or contains something |
| **A list contains** | A list has an item |
| **They have a role**, **They have a permission** | The member using it |
| **It's used in** | A channel |
| **A random chance** | 1% to 99% of the time |
| **They can manage the server**, **They're in a voice channel**, **They're boosting** | The member using it |
| **Both are true**, **Either is true**, **It's not true that** | Combine conditions, up to 4 deep |

## Variables

Type a variable into any text box and cure fills it in when the block runs. Click one in the **Variables** tab to copy it.

### Your own variables

| Variable | Lasts | Shared |
| - | - | - |
| `{var:name}` | One run | No |
| `{svar:name}` | Saved | The whole server |
| `{mvar:name}` | Saved | One per member |
| `{list:name}`, `{slist:name}`, `{mlist:name}` | The same, for lists, shown comma-separated | |

Choose which kind with **Set a variable**'s "this run's", "the server's" or "the member's". A run's variables start empty every time, including when a button is pressed, because a button press is a new run. If a button's function needs something, save it for the member.

Saved variables are shared with [workflows](https://docs.curebot.site/studio/workflows.md): a workflow can count `{mvar:warnings}` and a command can show it. The **Variables** tab lists every saved value; deleting a server variable empties it, and deleting a member variable empties it for everyone. A server keeps up to 200 saved variables, each member up to 50, and each value up to 500 characters (lists 20,000).

### Filled in for you

| Group | Variables |
| - | - |
| **The member** | `{user.mention}`, `{user.name}`, `{user.display_name}`, `{user.id}`, `{user.avatar}`, `{user.joined_at}`, `{user.top_role}`, `{user.points}`, `{user.coins}` and more |
| **Server** | `{guild.name}`, `{guild.member_count}`, `{guild.boost_count}`, `{guild.icon}` and more |
| **Channel and bot** | `{channel.mention}`, `{channel.name}`, `{bot.mention}` |
| **Date and time** | `{date.now}`, `{time.now}`, `{date.utc_timestamp}` |
| **Arguments** | `{args}` (everything typed), `{arg:1}`, each argument by its name like `{target}`, and `{target.id}`, `{target.name}` |
| **From start blocks and loops** | `{var:content}`, `{var:emoji}`, `{var:message_author}`, `{var:button}` (the pressed button's text), `{var:loop}`, `{var:item}`, `{var:index}`, `{var:input1}` to `{var:input3}` |

The full list is in the [script reference](https://docs.curebot.site/studio/scripts.md).

## Arguments and settings

### Arguments

Arguments are what members type after the command: in `,give @sukii 50`, `@sukii` and `50`. Add up to 8 in **Arguments & settings**, or on the start block.

| Type | Takes |
| - | - |
| **Text** | One word |
| **Number** | A number |
| **Member** | A mention, ID or name |
| **Channel**, **Role** | A mention, ID or name |
| **Rest of the message** | Everything left, spaces included. Must be last |

Each argument can be **Required**, and an optional one can have a default. When a required one is missing or wrong, cure shows the usage instead of running, like `,give <member> <amount>`.

![Arguments in the Arguments and settings tab](https://mintcdn.com/cure/JT6OLTifSCrGzVw3/images/screenshots/custom-commands-settings.png?fit=max\&auto=format\&n=JT6OLTifSCrGzVw3\&q=85\&s=ca4bf5acc6d78d2fb4d7e1095ca34d0e)

Arguments, in Arguments & settings.

### Settings

| Setting | What it does |
| - | - |
| **Also a slash command** | Adds `/name` in this server. Arguments become its options, so required ones must come first. Up to 25 per server |
| **Description** | Shown in `/` and in help |
| **Other names** | Up to 5 more names that run it |
| **Cooldown in seconds** | Per member. 0 means no wait |
| **Only these roles can use it** | Others are told they can't. People with Manage Server always can |
| **Only in these channels** | Elsewhere it says it doesn't work there |

"When a message says" and "When someone reacts" scripts have their own per-member cooldown of at least 5 and 3 seconds, so a busy channel can't set them off over and over. They never run for bots or for cure's own commands.

## Buttons and functions

Buttons are how a command keeps going after it's used. **Post buttons** and **Send a container** add up to 5 buttons, each running a **function** as whoever presses it.

**1. Make the function**

Drag **Define a function** onto the canvas and name it, like `toggle_pings`. Put the blocks under it.

**2. Post the button**

In the command's main script, add **Post buttons** and pick `toggle_pings` for a button.

**3. Press it**

Anyone who presses the button runs `toggle_pings` as themselves, so **Toggle a role** gives *them* the role.

![](https://docs.curebot.site/images/showcase-member.png)

in the poolToday at 4:12 PM

,pings

![](https://docs.curebot.site/images/cure-avatar.jpg)

cureAPPToday at 4:12 PM

**Get notified**

Press the button to get pings for announcements. Press it again to stop.

`{var:button}` is the pressed button's text. A function called with **Call a function** gets its inputs as `{var:input1}` to `{var:input3}`, and can **Return a value**. Another command's function is `command.function`.

[Workflows](https://docs.curebot.site/studio/workflows.md) can run a function too, with **Run a custom command**, so a schedule or another bot's command can use everything you built here.

## Testing

The **Test** tab walks through the blocks as if you used the command, with the arguments you type, in the channel you pick. Nothing is sent, no roles or rewards change, and no variables are saved. It lists every step it would take, what each message would say, and why it stopped. To test another script, like a function or a trigger, pick it there.

## Limits

| Limit | Amount |
| - | - |
| Custom commands per server | 50 |
| Slash custom commands per server | 25 |
| Blocks per command | 200 |
| Scripts per command | 20 |
| Blocks nested inside each other | 6 deep |
| Steps per run | 400 |
| Messages per run | 5 |
| Waiting per run | 15 seconds |
| Ask and wait | 3 per run, 60 seconds each |
| Calls to functions and other commands, per run | 8 |
| Repeat | 25 rounds |
| Arguments | 8 |
| Other names | 5 |
| Buttons per message | 5 |
| Points or coins moved per run | 100,000 |
| Items in a list | 100 |
| Text in a field | 2,000 characters |

Roles must be below cure's highest role, and a run stops when it reaches a limit.

## Recipes

> [accordion] A daily reward with a streak
>
> 1. **When the command is used** (`,daily`).
> 2. **Look up**: Time, date, save as `today`.
> 3. **If** `{mvar:last_daily}` equals `{var:today}`: **Reply** "Already claimed today. Come back tomorrow." then **Stop**.
> 4. **Give or take coins**: add 100.
> 5. **Set a variable** `last_daily` to `{var:today}`, the member's.
> 6. **Change a variable by** `streak` by 1, the member's.
> 7. **Reply** `+100 coins, {user.mention}. Streak: {mvar:streak} days.`

> [accordion] A giveaway-style raffle with a button
>
> 1. Main script, only for your Mods role: **Change a list**, clear `entries` (the server's), then **Post buttons** "Enter" → function `enter`.
> 2. Function `enter`: **If** a list contains: `entries` (server) has `{user.id}` → **Reply** privately "You're already in". **Else** → **Change a list** add `{user.id}` to `entries` (server), and **Reply** privately "You're in".
> 3. A second command, `,draw`, only for your Mods role: **Read from a list** random item from `entries`, save as `winner`, then **Reply** `<@{var:winner}> wins`.

> [accordion] Suggestions with a cooldown
>
> 1. Arguments: `idea`, **Rest of the message**, required.
> 2. Settings: cooldown 300 seconds.
> 3. **Send an embed** as a post in #suggestions: title "New idea", description `{idea}`, footer `from {user.name}`.
> 4. **Reply** privately "Sent, thanks."

> [accordion] Rock, paper, scissors
>
> 1. Argument `pick`, Text, required.
> 2. **Pick at random** rock, paper, scissors, save as `bot`.
> 3. **If** compare `{pick}` equals `{var:bot}`: **Reply** `We both picked {var:bot}. Draw.`
> 4. **Else** **If** (either is true: `{pick}` is rock and `{var:bot}` is scissors, …): **Reply** `I picked {var:bot}. You win`, **Change a variable by** `wins` 1, the member's.
> 5. **Else** **Reply** `I picked {var:bot}. I win.`
> 6. A second command `,rpstop` with **Leaderboard** by `wins` shows the best players.

## Custom commands or workflows?

| | Custom commands | [Workflows](https://docs.curebot.site/studio/workflows.md) |
| - | - | - |
| **Starts from** | A command, a few events, buttons, a timer | 49 triggers: events, schedules, other bots' commands |
| **Best for** | Things members use: commands, buttons, games | Server automation that runs by itself |
| **Waits** | 15 seconds per run | Up to 30 days, survives restarts |

Use a custom command when a member *does* something, and a workflow when something *happens*. They share saved variables, and a workflow can run a custom command's function.

## Troubleshooting

> [accordion] The command doesn't answer
>
> * Is it **On**, and saved?
> * Is the member in one of its roles and channels, if you set any?
> * Is it on cooldown for them?
> * Does another command or [alias](https://docs.curebot.site/reference/customize.md) already use the name? cure's own commands win.

> [accordion] A role block fails
>
> Move cure's role above the role it gives or takes, in **Server Settings → Roles**.

> [accordion] A button's function forgets something
>
> A button press is a new run, so `{var:…}` variables from the command that posted it are empty. Save what it needs with "the member's" or "the server's", and read it with `{mvar:…}` or `{svar:…}`.

> [accordion] The slash command doesn't show up
>
> Turn on **Also a slash command** and save. Discord can take a minute to show it, and a server has room for 25. Required arguments must come before optional ones.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.