Building Your First Custom Command
Two worked examples: a plain info command, and one with options that grants a role, sends a DM, and confirms it.
What Custom Commands do
Custom Commands become real Discord slash commands, created, updated, and removed through Discord's API, with their own arguments people fill in when they type /yourcommand. A command runs one or more actions in order, top to bottom, when someone uses it.
See the full referenceExample: a simple info command
The simplest command is a fixed reply with no options and one action. Good for FAQs, rules, or anything you keep typing out by hand:
| Field | Value |
|---|---|
| Name | rules |
| Description | Show the server rules |
| Options | None |
| Action | Reply: "📋 Check out #rules for our full server guidelines!" |
Example: options that grant a role and send a DM
Options get more useful once an action uses them for more than text. This command takes two required options, who to grant access to and a personal note, then runs three actions: it adds a fixed role to the selected member, DMs them with the note included, and replies to confirm.
Options
| Option | Type | Description |
|---|---|---|
{member} | User | Required. The member to grant access to |
{message} | Text | Required. A personal note to include in their DM |
Actions
| Action | Configuration |
|---|---|
| 1. Add Role | Target: member (Custom Option) · Role: Member (fixed) |
| 2. Send DM | Target: member (Custom Option) · Message: "Welcome! {message}" |
| 3. Reply | "✅ Done, {member.mention} now has access." · Ephemeral: on |
Publishing and testing it
Saving a command registers it with Discord automatically. There's no separate publish step. It can take a minute or two to appear when you type /, and if the command list ever looks outdated, the Sync Now button in Custom Commands re-registers everything at once.
You've got the basics
From here, try the Random Reply action for variety, or explore Groups to keep a growing set of commands organized.