Minecraft was a game I did not play until the beginning of 2023. I was fortunate enough to be gifted the game and got to see what the hype was all about (some 12 years later). Having a spare computer, I wanted to get into server hosting. I thought hosting a Minecraft server would be a great way to learn since there is plenty of documentation. In addition, since this server would be hosted "some what" 24/7, I wanted to create an application that would notify me when players would enter and leave the server. What better way for this application to be is a Discord bot.
Given ChatGPT's popularity in early 2023, it was a tool that I never use until developing this project. I wanted to challenge ChatGPT to see if it can provide an MVP Discord bot using the RCON protocol. In addition, I wanted to use Python rather than Javascript because this is a great opprotunity to learn how to develope a Discord bot in another programming langauge.
Before you use this Discord bot for Minecraft, you must set up a Discord bot first.
- Log on to the Discord website.
- Naviagte to the application page.
- Click the “New Application” button.
- Give the your Discord bot a name i.e. "MyMinecraftBot" and click “Create”.
- Navigate to the “Bot” tab for configuration.
- Make sure that your Discord bot is ticked for PUBLIC BOT so you can invite the bot to your server.
- Copy the Discord bot token using the “Copy” button. Note: Keep this token in a safe location
- If you are not on your Discord bots page, navigate to the bots page.
- Go to the “OAuth2 -> URL Generator” tab.
- Click the "bot" checkbox under "scopes". Note: This may change over time as new features get implemented
- Navigate to the bottom of the page and copy your Discord bot url under GENERATED URL.
- Paste the URL into browser URL field and select which server to invite your bot.
To have your Discord bot communicate with people in Discord and players in Minecraft, you need to enable the RCON protocol by following these steps:
-
Set up a Minecraft server that supports RCON.
-
Enable RCON on your Minecraft server. This is usually done by adding the following lines to your server.properties file:
enable-rcon=true
rcon.password=<your_rcon_password>
rcon.port=<your_rcon_port>
Make sure to replace <your_rcon_password>
and <your_rcon_port>
with the actual values you want to use.
- Download the Minecraft Discord Bot Setup Wizard executable here.
- The Setup Wizard will download and install the latest Minecraft Discord Bot release.
- Follow the configuration instructions to get your Minecraft Discord Bot started.
The Minecraft Discord Bot provides:
1. Users and Players the ablility to chat between the Minecraft and Discord Server
2. Notifications to Discord users when a player joins and leaves a game.
3. Notifications to Discord users when a player dies or earns an achievement.
4. Notifications to Discord users when the bot stops reading the Minecraft server logs (this allows the Minecraft server to create new logs).
5. Notifications to Discord users when the Minecraft server host stops the server.