Discord bot that monitors a Minecraft Java server and updates a voice channel name with the current player count.
🔊 Voice Channel: "Online: 12/50" ← Updates automatically
- Auto-updating channel name: Shows
Online: X/Maxor custom prefix - Configurable interval: Default 90s (respects Discord rate limits)
- Clean async architecture: Uses
discord.pytasks - Environment-based config: No hardcoded secrets
- Interactive first-run setup: Creates
config.iniif missing - Graceful error handling: Logs errors, continues running
- Python 3.10+
- Discord bot with
Manage Channelspermission - Minecraft Java server with query enabled (or standard ping)
# 1. Clone
git clone <repo>
cd Minecraft-Server-Monitor
# 2. Install deps
pip install -r requirements.txt
# 3. Configure
cp .env.example .env
# Edit .env with your values
# 4. Run
python -m src.main| Variable | Required | Description |
|---|---|---|
DISCORD_TOKEN |
✅ | Bot token from Discord Developer Portal |
MC_SERVER_ADDRESS |
✅ | Minecraft server IP/hostname |
MC_SERVER_PORT |
✅ | Server port (default 25565) |
DISCORD_CHANNEL_ID |
✅ | Voice channel ID to rename |
DISCORD_GUILD_ID |
✅ | Discord server (guild) ID |
CHANNEL_DISPLAY_NAME |
❌ | Prefix text (default: "Online") |
UPDATE_RATE |
❌ | Seconds between updates (min 90 recommended) |
- Enable Developer Mode in Discord (Settings → Advanced)
- Right-click server → Copy Server ID =
DISCORD_GUILD_ID - Right-click voice channel → Copy Channel ID =
DISCORD_CHANNEL_ID
Minecraft-Server-Monitor/
├── src/
│ └── main.py # Bot entry point
├── requirements.txt
├── .env.example
├── .gitignore
└── README.md
JavaServer.lookup()frommcstatuspings the serverstatus.players.online/.maxgives current/max players- Background task (
@tasks.loop) runs everyUPDATE_RATEseconds - Updates voice channel name via
channel.edit(name="...")
Discord limits channel edits. Keep UPDATE_RATE ≥ 90 to avoid 429 errors.
The bot warns if you set it lower.
| Issue | Fix |
|---|---|
| "Guild/Channel not found" | Check IDs, ensure bot is in server |
| "Invalid token" | Regenerate token in Developer Portal |
| "Connection refused" | Check server IP/port, firewall |
| 429 Too Many Requests | Increase UPDATE_RATE to 120+ |
| Config not saving | Run with write permissions |
MIT — use freely, attribution appreciated.
Originally created ~2023, modernized 2025