MineBot/README.md

85 lines
2.3 KiB
Markdown
Raw Permalink Normal View History

2024-04-10 22:57:07 +00:00
# MineBot
2024-04-10 22:57:07 +00:00
A Discord bot for managing your Minecraft server via [Minecraft Minder](https://git.zyphon.com/will/minecraft-minder)
Forked from [SparkBot](https://github.com/jkkicks/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
2024-04-10 22:57:07 +00:00
### 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
```
2024-04-10 22:57:07 +00:00
#### Hidden commands
```
2024-04-10 22:57:07 +00:00
/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
2024-04-10 22:57:07 +00:00
creates the SQLITE3 file `bot_data.db`.