A Discord bot that manages Minecraft servers through the Crafty Controller API. Features include starting servers, checking statuses, and automatic shutdown of inactive servers. This is mainly for small servers hosted at home for a few friends.
/start [servername]- Start a Minecraft server/status [servername]- Check server status- Automatic server shutdown after configurable period of inactivity
- Automatic backup before shutdown
- Channel-specific command restrictions
- Discord notifications for auto-shutdown events
- Python 3.10 or higher
- Crafty Controller v2 instance
- Discord Bot Token
- Docker (optional)
- Pull the image:
docker pull idiosync000/crafty-discord-control:latest- Run the container:
docker run -d \
--name crafty-discord-control \
-e DISCORD_TOKEN=your_token \
-e DISCORD_GUILD_ID=your_guild_id \
-e DISCORD_CHANNEL_ID=your_channel_id \
-e CRAFTY_HOST=your_host \
-e CRAFTY_PORT=your_port \
-e CRAFTY_SSL=true \
-e CRAFTY_API_KEY=your_key \
-e MINECRAFT_SERVERS=survival:your-uuid \
-e AUTO_SHUTDOWN_ENABLED=true \
-e AUTO_SHUTDOWN_MINUTES=30 \
idiosync000/crafty-discord-control:latest-
Clone the repository
-
Install dependencies
pip install -r requirements.txt -
Create a
.envfile with your configuration:
# Discord Bot Configuration
DISCORD_TOKEN=your_discord_bot_token
DISCORD_GUILD_ID=your_guild_id
DISCORD_CHANNEL_ID=your_channel_id
# Crafty Controller Configuration
CRAFTY_HOST=crafty_ip
CRAFTY_PORT=8443
CRAFTY_SSL=true
CRAFTY_API_KEY=your_api_key
# Server Configuration (format: name:uuid,name2:uuid2)
MINECRAFT_SERVERS=survival:00000000-0000-0000-0000-000000000000
# Auto-shutdown configuration (in minutes)
AUTO_SHUTDOWN_ENABLED=true
AUTO_SHUTDOWN_MINUTES=30- Run the bot:
python bot.py- Go to Discord Developer Portal
- Create a new application
- Go to the Bot section and create a bot
- Enable these Privileged Gateway Intents:
- Presence Intent
- Server Members Intent
- Message Content Intent
- Copy the bot token and add it to your
.envfile - Generate an invite link with these permissions:
- Send Messages
- Use Slash Commands
- View Channels
- Invite the bot to your server
- Crafty Controller for the server management API
- Pycord for the Discord bot framework