Named for the ever popular and ever annoying blue slimes from the Tinker's Construct mod, that seem to spawn everywhere in ultra-modded survival.
This is a Discord bot that allows for the remote and shared management of game servers, in particular designed for Minecraft servers.
There are four commands (excluding the help command generated by discord.py):
-
?run (profile)
- Starts running the given profile -
?check (profile)
- Checks the current status of the given profile, whether it's running or stopped -
?kill (profile)
- Kills a profile, sending aSIGKILL
and forcing it to stop -
?console (profile) [input...]
- Sends some input to the standard input for a profile, if this is enabled. This allows for e.g. interacting with Minecraft servers.
To set up the bot locally:
-
Create a Discord developer account (if you don't already have one), then create a new application with a bot user.
-
Install Python 3 (tested with Python 3.7+) and the Pip package manager. Using Pip (for Python 3 specifically) install
discord.py
. On Debian-based Linux, this looks like:
sudo apt install python3 python3-pip
pip3 install discord.py
-
Run the bot once, either using
python3 blueslime.py
or by makingblueslime.py
executable and running it directly. This will generateconfig.json
-
Populate
config.json
with your bot token, the channel ID where you plan to use the bot (which can be found by enabling 'Developer Mode' on Discord, right clicking on the channel, and clicking 'Copy ID'), and any profiles for game servers you want to run. -
Re-run the bot, and you're done. It's helpful to leave the bot running in a background
screen
ortmux
session if you're running off a VPS, just as you would a normal game server.
The config file has three top-level fields, token
is the Discord bot token, channel
is the list of IDs (as a integers, not strings) where you plan to use the bot, and profiles
is a dictionary of profiles you plan to run.
Each profile has a key, which should be a short one-word description of the game server (e.g. modded
, vanilla
, creative
), the value is another dictionary containing the following fields:
-
command
- A list of strings which are the command-line name and arguments for the game server. -
console
- A boolean value which decides if the game server should be able to accept console (i.e. command line) input. This is useful to turn off if you have shorter tasks you also want to run through the bot which don't need to accept any command-line input. -
directory
(optional) - A path to the directory where this game server should be run from. This is useful for Minecraft servers in particular, since they dump all their files in the current directory.
This is an example profile for a modded Minecraft server:
"modded" : {
"command" : [ "java", "-Xmx2G", "-Xms2G", "-jar", "forge-1.7.10.jar", "nogui" ],
"console" : true,
"directory" : "/home/nick/Desktop"
}