A Discord bot for remotely managing a Minecraft server.
This bot uses tmux to run your server in the background, and PostgreSQL to record messages sent by the bot so that information can be persisted between bot restarts, so make sure these are installed first.
Python packages are managed by poetry, and you're highly encouraged to use venv or virtualenv when you install packages for this project.
Install the packages using:
poetry install
Copy
.env_template
to.env
to set configuration options:cp .env{_template,}
The following configuration options are required:
BOT_TOKEN
is the token for your bot on Discord. Refer to the Discord documentation for more information.
The following configuration options are optional:
SERVER_PATH
is the directory where the server will be run from. By default this is~/minecraft_server
.EXECUTABLE_FILE
is the name of the script that will be executed to run your server, relative to`SERVER_PATH
. The simplest form is to just run the server by callingjava
:java -Xmx2G -jar server.jar nogui
Make sure that the server command line can be accessed while this script is running. By default, this is
./run.sh
SESSION_NAME
is the name of thetmux`
session that the bot will use to manage the session. If the name is blank, or not set then the default isminecraft_server
.DATABASE_NAME
is the name of the database on will be used by the bot. By default this isminecraft_server_bot
.MAX_WAIT_FOR_ONLINE
is the maximum time in seconds that the bot will wait for the server to be online before showing that the server has not been started. Can be useful for servers with a long startup.
Create the database with the name under the
DATABASE_NAME
key in your configuration.
First, run the migrations to update your database schema:
aerich upgrade
Then you can run the Bash script run.sh
:
./run.sh
Do not main.py
directly.
See CHANGELOG.rst.
Refer to LICENSE for the full licence text.