Skip to main content

List Commands

Retrieves all registered Discord slash commands for an application.

Common Properties

  • Name - The custom name of the node.
  • Color - The custom color of the node.
  • Delay Before (sec) - Waits in seconds before executing the node.
  • Delay After (sec) - Waits in seconds after executing node.
  • Continue On Error - Automation will continue regardless of any error. The default value is false.
info

If the ContinueOnError property is true, no error is caught when the project is executed, even if a Catch node is used.

Inputs

  • Client Id - The Discord bot client identifier from the Connect node (optional if Bot Token provided).
  • Application Id - The Discord application ID.

Options

  • Bot Token - Discord bot token credential (optional if using Client ID from Connect node).
  • Server Id - (Optional) Server (guild) ID to list server-specific commands. If empty, lists global commands.

Output

  • Commands - An array of command objects containing all registered commands.

How It Works

The List Commands node retrieves all slash commands registered for your application. When executed, the node:

  1. Authenticates using either Client ID or direct bot token
  2. Validates the application ID
  3. Requests command list from Discord API (global or server-specific)
  4. Returns an array of command objects

Requirements

  • Active Discord bot session (Client ID) or bot token credentials
  • Valid application ID
  • applications.commands scope enabled

Error Handling

The node will return specific errors in the following cases:

  • ErrInvalidArg - Client ID or bot token missing/invalid
  • ErrInvalidArg - Application ID is empty
  • ErrInternal - Error retrieving commands from Discord

Command Object Structure

Each command in the array contains:

{
"ID": "123456789012345678",
"ApplicationID": "987654321098765432",
"GuildID": "111111111111111111",
"Name": "ping",
"Description": "Check bot latency",
"Type": 1,
"Options": [],
"Version": "123456789"
}

Key properties:

  • ID - Unique command identifier (needed for deleting)
  • ApplicationID - Your application ID
  • GuildID - Server ID (null for global commands)
  • Name - Command name
  • Description - Command description
  • Type - Command type (1=Slash, 2=User, 3=Message)
  • Options - Array of command options/parameters
  • Version - Command version (auto-updated by Discord)

Example: List All Global Commands

Inputs:

  • Application Id: "123456789012345678"
  • Server Id: (empty)

Flow:

1. List Commands → cmds
2. For each command in cmds:
- Log: "Command: /{{command.Name}}"

Result: Lists all global commands.

Example: List Server Commands

Inputs:

  • Application Id: "123456789012345678"
  • Server Id: "987654321098765432"

Flow:

1. List Commands → cmds
2. Log: "Found {{cmds.length}} commands"

Result: Lists all commands for the specific server.

Example: Find Specific Command

Flow:

1. List Commands → cmds
2. For each command in cmds:
- Condition: command.Name == "admin"
- If True:
- Store command.ID for later use
- Log: "Found admin command: {{command.ID}}"

Result: Find and store a specific command's ID.

Example: Command Audit

Flow:

1. List Commands (global) → global_cmds
2. List Commands (server) → server_cmds
3. Generate report:
- Global commands: {{global_cmds.length}}
- Server commands: {{server_cmds.length}}
- Total: {{global_cmds.length + server_cmds.length}}

Result: Audit of all registered commands.

Use Cases

  • Command management - View all registered commands
  • Cleanup - Find commands to delete
  • Audit - Track which commands are active
  • Verification - Check if command registration succeeded
  • Migration - List commands before moving to another app
  • Documentation - Generate command reference automatically

Accessing Command Data

Loop through the commands array:

For each command in {{cmds}}:
- Name: {{command.Name}}
- ID: {{command.ID}}
- Description: {{command.Description}}

Global vs Server Commands

List Global Commands:

  • Leave Server Id empty
  • Returns all commands available in every server

List Server Commands:

  • Provide Server Id
  • Returns only commands for that specific server

Command Management Flow

1. List Commands → get all commands
2. For each command:
- Check if still needed
- If not needed:
- Delete Command (using command.ID)
3. Create new commands as needed

Tips and Best Practices

  • Regular audits - Periodically check registered commands
  • Cleanup - Remove unused commands to stay within limits
  • Documentation - Use command lists to generate help documentation
  • Version tracking - Monitor version changes
  • Server vs Global - Check both scopes when auditing
  • Command limits - Remember the 100 command limit per scope
  • ID storage - Store command IDs if you need to delete them later