8.0 KiB
Minecraft Update Bot
Version 1.0.0 - Automatically detects new Minecraft releases (Java and Bedrock editions) and posts announcements to a subreddit.
Features
Core functionality:
- Polls the official Minecraft launcher manifest for new Java Edition releases
- Detects Minecraft Bedrock Edition updates via minecraft.wiki scraping
- Posts new releases to a configured subreddit automatically
- Maintains a database of posted versions to prevent duplicate posts
- Supports multiple release types (releases, snapshots, beta versions)
- Configurable check interval for polling
Advanced features:
- Customizable post templates via subreddit wiki configuration
- Different post formats for different release types
- Moderator chat commands for config reload and manual reposting
- Automatic bot update notifications via modmail
- Docker and Docker Compose deployment ready
- Persistent version tracking across container restarts
Quick Start
Docker (Recommended)
-
Copy the environment template:
copy .env.example .env -
Edit
.envwith your Reddit credentials:REDDIT_CLIENT_ID=your_id REDDIT_CLIENT_SECRET=your_secret REDDIT_USERNAME=your_username REDDIT_PASSWORD=your_password SUBREDDIT=your_subreddit -
Start the bot:
docker-compose up -d -
View logs:
docker-compose logs -f
See DOCKER.md for detailed Docker setup instructions.
Manual Setup
-
Install dependencies:
pip install -r requirements.txt -
Create a Reddit application at https://www.reddit.com/prefs/apps (select "Script" type)
-
Configure environment variables or edit config.py:
set REDDIT_CLIENT_ID=your_client_id set REDDIT_CLIENT_SECRET=your_client_secret set REDDIT_USERNAME=your_username set REDDIT_PASSWORD=your_password set SUBREDDIT=your_subreddit python main.py
Configuration
Environment Variables
Required variables:
- REDDIT_CLIENT_ID - Your Reddit OAuth app client ID
- REDDIT_CLIENT_SECRET - Your Reddit OAuth app secret
- REDDIT_USERNAME - Reddit account username
- REDDIT_PASSWORD - Reddit account password
- SUBREDDIT - Target subreddit name
Optional variables:
- REDDIT_RELEASE_TYPES - Comma-separated types: release,snapshot (default: release)
- REDDIT_CHECK_BEDROCK - Enable Bedrock detection: true or false (default: false)
- REDDIT_CHECK_INTERVAL - Seconds between checks (default: 3600)
- REDDIT_WIKI_PAGE_NAME - Wiki page for post templates (default: minecraft_update_bot)
- REDDIT_USER_AGENT - API user agent string (default: MinecraftUpdateBot/1.0)
Wiki Configuration
Post templates are defined in a subreddit wiki page (default name: minecraft_update_bot).
Create entries for each release type with title and body templates:
release:
title: "Minecraft {version} Released"
body: |
New version available at minecraft.net
Released: {release_date}
snapshot:
title: "Minecraft {version} Snapshot"
body: |
Test build available in launcher
Released: {release_date}
bedrock-windows:
title: "Bedrock Edition {version} Available"
body: |
Download from Microsoft Store
Released: {release_date}
Available placeholders: {version}, {release_date}, {type}
See WIKI_CONFIG.md for complete wiki configuration details.
Moderator Chat Commands
Moderators can control the bot via Reddit chat messages:
reload-config
- Reloads wiki configuration without restarting the bot
- Usage: Send a chat message containing "reload-config"
- Response: Bot replies with success or failure status
repost-latest
- Reposts the latest releases (bypasses duplicate check)
- Usage: Send a chat message containing "repost-latest"
- Response: Bot replies with number of versions reposted
Bedrock Edition Support
The bot can track Minecraft Bedrock Edition (Windows) releases by scraping the official minecraft.wiki version history page.
Enable with Docker:
REDDIT_CHECK_BEDROCK=true
Or environment variable:
set REDDIT_CHECK_BEDROCK=true
python main.py
Note: Bedrock versions use the new format (26.x, 27.x, etc.) and are detected from the wiki page. Java Edition will eventually use the same versioning scheme.
Release Types
Supported Java Edition release types:
- release - Final Java Edition releases
- snapshot - Development snapshots
- old_beta - Legacy beta versions
- old_alpha - Legacy alpha versions
Supported Bedrock Edition types:
- bedrock-windows - Windows Bedrock releases
Database and Persistence
Posted versions are tracked in DB/posted_versions.json. This prevents duplicate posts when the bot restarts.
With Docker, data persists in a named volume (minecraft-bot-db).
To reset the database and repost all versions:
- Docker:
docker volume rm minecraft-bot-dbthen restart - Manual: Delete DB/posted_versions.json
Logs
Docker logs:
docker-compose logs -f
Watch for status messages with [BOT], [CHAT], [BEDROCK_CHECKER] prefixes.
Files Overview
- main.py - Bot orchestration and update checking
- config.py - Configuration loader
- minecraft_checker.py - Java Edition version checker
- bedrock_checker.py - Bedrock Edition version checker via wiki scraping
- wiki_config.py - Wiki page configuration manager
- update_checker.py - Bot update notifications
- requirements.txt - Python dependencies
- Dockerfile - Container image definition
- docker-compose.yml - Docker Compose configuration
- DB/ - Version tracking database (auto-created)
Check every 10 minutes (for testing)
CHECK_INTERVAL = 600
### 5. Run the Bot
```bash
python main.py
You should see output like:
[BOT] Starting Minecraft Update Bot...
[BOT] ✓ Successfully connected to Reddit
[BOT] Started update checker (checking every 3600 seconds)
[BOT] ✓ Bot is running
Automatic Update Notifications
The bot includes an update checker that periodically polls for new versions and notifies your subreddit's modteam via modmail when updates are available.
How it works:
- Checks
https://updts.slfhstd.ukevery hour for new versions - Sends modmail to your subreddit's modteam if an update is found
- Limits notifications to once per 24 hours to avoid spam
- No configuration needed - it runs automatically!
What you'll see:
[UPDATE_CHECKER] Started for MinecraftUpdateBot v1.0
[UPDATE_CHECKER] Update found: 1.0 -> 1.1
[UPDATE_CHECKER] Sent update notification to r/your_subreddit
The modteam will receive a message with the new version number and changelog link.
How It Works
- Initialization: Bot connects to Reddit and loads posted versions from
DB/posted_versions.json - Check Loop: Every CHECK_INTERVAL seconds, it:
- Fetches the latest Minecraft versions from Mojang's launcher manifest
- Checks if any are new (not in
DB/posted_versions.json) - Posts to subreddit if new versions found
- Saves the posted version IDs
- Background: Runs in background thread, checking continuously
Database
Posted versions are stored in DB/posted_versions.json:
{
"posted": [
"1.20.1",
"1.21",
"1.21.1"
]
}
To reset (post all new versions again), delete or clear this file.
Troubleshooting
Connection Issues
- Check your credentials in
config.pyor environment variables - Verify your Reddit app is configured correctly
- Make sure your Reddit account can post to the subreddit
"No New Releases"
- The bot only posts once per version
- Check
DB/posted_versions.jsonto see what's been posted - Delete a version from the file to repost it
Test with Snapshots
Change RELEASE_TYPES = ["snapshot"] and CHECK_INTERVAL = 60 to test quickly.
Files
main.py- Main bot scriptconfig.py- Configurationminecraft_checker.py- Fetches version data from Mojangtest_setup.py- Validates your setupDockerfile- Docker image definitiondocker-compose.yml- Docker Compose configurationDB/- Database folder (created automatically)requirements.txt- Python dependencies
License
MIT