Guide Explorer

CRASHPANEL

Getting Started

Create Content

CrashAdmin

CrashItems

CrashCommand

CrashBlock

CrashMob W.I.P.

Guide > Basics > Discord Bot

Discord Bot Integration Guide

Connecting the Bot to Your Server

Go to the Discord Bot page and click the link to connect the bot to your Discord server.

Grant all the necessary permissions and ensure the bot is present in your server.

IMPORTANT: Do not connect Discord servers over which you do not have full control.

Next, execute the /crashpanel command and specify the CONNECT CODE field by retrieving the code from the panel.

Finally, activate the Discord Bot from the properties. This allows you to easily disconnect everything in case of an emergency.

Unlinking a Server

To disconnect a server, you can use the /crashpanel unlink command, specifying the server ID.

Creating a Custom Command

To create a command, click on CREATE A COMMAND, then fill out the form (we will look at the options later) and click CREATE.

Then, go to the Generic Scripts page and create a new file. To avoid confusion, remember to rename the file by clicking SETTINGS.

Click EDIT to enter the Script Editor and start scripting the node.

Scripting a Command

In the Script Editor, use "On Discord Command" to listen for the event and enter the command's ID in the node.

Then, for this example, we will broadcast a message and use "Send Response" to send a reply on Discord.

Using Options in Commands

Let's try to print a text passed as an option. First, add an option to the command with the ID "text" and type "String" (this is mandatory, as it will make it simpler for us in the script).

Now you can update the script as follows:

  • Options are contained in a map where the key is the option ID and the value is always text.
  • Other types of options are also saved as text, but they might indicate the ID of the object taken as input or a different data format (as is the case with numbers).

Listening for Messages and Reactions

To listen for sent messages (and also reactions) in a specific chat, you will need to:

  • Enable listening for messages (or reactions) in the Discord Properties (found on the Discord Bot page).
  • Enable individual channels via Discord with the /crashpanel channel command.

In the Script Editor, you will only need to use "On Discord Message" and specify the Channel ID, which you can retrieve from Discord (right-click on the channel you activated, then copy the ID).

Final Recommendations

In the Script, you will find many nodes in the Discord Bot and Discord Listeners sections. The advice is to try them out directly. If they don't work, try enabling some properties on the Discord Bot page, reread this guide carefully, or ask for help on the Discord server.

ADVICE: Activate all the properties of the Discord Bot.

IMPORTANT: Ensure that the permissions on Minecraft, CrashPanel, and Discord are set correctly, because one could compromise all the others.