Page cover

๐Ÿ“‚Configuration

Complete guide to configuring custom commands and buttons

Getting Started

The Command Maker addon is configured through the command_maker.json file located in your bot's configuration/ folder. This guide will walk you through creating custom commands and buttons step-by-step.


Part 1: Creating Custom Commands

Step 1: Understanding Command Structure

Each custom command is defined within the commands object. You can create up to 5 custom commands. Here's the basic structure:

{
    config: {
        commands: {
            "command_id": {
                enabled: true,
                command_name: "commandname",
                command_description: "Description shown in Discord",
                command_permission: "everyone",
                command_parameters: [],
                command_message_response: { ... },
                actions: []
            }
        }
    }
}

Step 2: Basic Command Configuration

Let's create a simple command that displays your Minecraft server IP:

1. Set the Command ID

The command ID is the unique identifier for your command in the config file. This is not visible to users.

2. Set Command Name & Description

The command name is what users will type in Discord (e.g., /ip). The description appears when users view the command.

3. Set Permissions

Control who can use this command. This must match a permission level from your Core plugin's permission configuration.

Common permission levels:

  • everyone - All server members

  • staff - Staff members and above

  • admin - Administrators only

  • management - Server management only


Step 3: Creating Predefined Messages

Before configuring the command response, you need to create a predefined message template.

circle-info

Creating Predefined Messages:

  1. Use the /sendmsg command in Discord to create a new message template

  2. Design your message with embeds, text, colors, images, etc.

  3. Press the Save button and assign it a unique predefined message ID

  4. Use this ID in your command configuration

For our Minecraft IP command, create a predefined message with ID minecraft_server_ip that contains your server information.


Step 4: Configure Command Response

Now configure what happens when the command is executed:

Options explained:

  • predefined_message_id - The ID of your saved message template

  • files - Array of file paths to attach (e.g., ["./images/banner.png"])

  • components - Array of button IDs to add to the message (e.g., ["info_button"])

  • ephemeral - If true, only the user who ran the command sees the response


Step 5: Adding Command Parameters

Parameters allow users to provide input when using your command. You can add parameters for user mentions or text with predefined options.

Example: Command with User Parameter

Let's create a /tutorial command that sends a tutorial message to a specific user:

Example: Command with String Options

Create a command where users select from predefined options:

Parameter Types:

  • USER - User mention/selection

  • STRING - Text input with optional predefined options


Step 6: Adding Actions

Actions execute automatically when the command is run. You can chain multiple actions together.

Available Action Types

ROLE_APPLY - Give the user a role:

ROLE_REMOVE - Remove a role from the user:

CHANNEL_SEND - Send a message to a specific channel:

USER_SEND - Send a DM to a user:

circle-exclamation

Step 7: Using Placeholders

Placeholders allow dynamic values in your actions:

  • %user_id% - The user who executed the command

  • %string_args_1% - The value of the first STRING parameter

  • %string_args_2% - The value of the second STRING parameter (if exists)

Example: Send different tutorials based on user selection:

In this example:

  • %user_id% will be replaced with the selected user's ID

  • %string_args_1% will be replaced with the tutorial name ("beginner", "advanced", or "expert")


Complete Command Example

Here's a fully configured custom command:

This command:

  1. Shows the server IP using the minecraft_ip_embed message

  2. Adds two buttons to the message

  3. Gives the user a "Player" role

  4. Sends an alert to a staff channel


Part 2: Creating Custom Buttons

Step 1: Understanding Button Structure

Buttons are defined in the components object. You can create up to 5 custom buttons:


Step 2: Basic Button Configuration

1. Set Button ID & Type

2. Set Button Text & Emoji

Set button_emoji: false if you don't want an emoji.

3. Choose Button Style

Available Styles:

  • Primary - Blue button

  • Secondary - Gray button

  • Success - Green button

  • Danger - Red button

  • Link - URL button (requires button_url)

For Link type buttons:


Step 3: Button Response & Actions

Button responses work the same as command responses:

Special Option:

  • message_update - If true, updates the message containing the button instead of sending a new message


Complete Button Example

This button:

  1. Shows a green button with a checkmark

  2. Sends an ephemeral success message

  3. Gives the user a "Verified" role

  4. Removes an "Unverified" role


Part 3: Practical Examples

Example 1: Server Rules Command


Example 2: Support Ticket Button


Example 3: Role Selection Menu


Tips & Best Practices

circle-check
circle-exclamation

Troubleshooting

Command not appearing in Discord

  • Ensure enabled: true is set

  • Check that command_name is unique and doesn't conflict with existing commands

  • Verify the bot has permission to register slash commands

  • Restart the bot after making configuration changes

Predefined message not found

  • Double-check the predefined_message_id spelling

  • Ensure you've saved the message using /sendmsg or /editmsg

  • Predefined message IDs are case-sensitive

Actions not executing

  • Verify role/channel IDs are correct (right-click with Developer Mode enabled)

  • Check that the bot has permission to assign roles or send messages to channels

  • Ensure role hierarchy - bot's role must be higher than the role being assigned

Buttons not working

  • Verify button ID matches the ID referenced in components array

  • Check enabled: true is set for the button

  • Ensure the button type is valid

  • For Link buttons, make sure button_url is a valid URL

Last updated