Minecraft Minder Discord Bot
Go to file
2024-04-10 17:47:00 -07:00
.gitignore Turn SparkBot into MineBot 2024-04-10 16:13:00 -07:00
env.dist Turn SparkBot into MineBot 2024-04-10 16:13:00 -07:00
main.py Move logging to systemd, add instructions 2024-04-10 17:47:00 -07:00
README.md Move logging to systemd, add instructions 2024-04-10 17:47:00 -07:00
requirements.txt Fix SQL lockups, get commands working, remove DB and availcommands and .env 2024-04-10 15:57:28 -07:00

MineBot

A Discord bot for managing your Minecraft server via Minecraft Minder

Forked from SparkBot

Prerequisites

  • Go to https://discord.com/developers/applications and make an application
  • Go to the Bot page.
  • Copy env.dist to .env and add the Bot Token to this file.
  • Choose what channels you want the bot to operate in on your server and add their IDs to the file as well.

Installation

  • Get this source code:
cd /opt
git clone https://git.zyphon.com/will/MineBot.git
cd MineBot
  • It's best to run services as non-root users:
sudo useradd minebot
sudo mkdir /home/minebot
sudo chown minebot:minebot /home/minebot
sudo chown -R minebot:minebot /opt/MineBot
  • Create a startup script (this is for systemd on i.e. Ubuntu):
[Unit]
Description=MineBot Service
After=multi-user.target

[Service]
Type=simple
User=minebot
Group=minebot
Restart=always
WorkingDirectory=/opt/MineBot
ExecStart=/usr/bin/python3 /opt/MineBot/main.py

[Install]
WantedBy=multi-user.target
  • This bot requires Python 3, so ensure you have that on your system.
  • Run sudo -u minebot pip install -r requirements.txt to install Python dependencies.

Running

  • Run sudo service minebot start or for testing/development you can run python3 main.py
  • Hide sensitive data from other users:
    • sudo chmod 600 /opt/MineBot/bot_data.db /opt/MineBot/bot.log .env
  • You probably want to run MineBot automatically on system startup:
    • sudo systemctl enable minebot

Usage

Command Tree

/addserver   - Add a Minecraft server to the bot (global)
/adduser     - Add a user to a Minecraft server (global)
/removeuser  - Remove a user from a Minecraft server
/listservers - List the Minecraft servers you have access to
/status      - Get the status of the first Minecraft server you have acces to
/start       - Start the first Minecraft server you have acces to

Hidden commands

/99          - Brooklyn 99 Quotes
/shutdown    - Kill the bot (global)
/sync        - Sync the slash-command tree with Discord

Database

Initialization of the structure is automatically handled inside main.py and creates the SQLITE3 file bot_data.db.