Release 1.0.0
This commit is contained in:
@@ -1,152 +1,195 @@
|
||||
# Minecraft Update Bot 🎮
|
||||
# Minecraft Update Bot
|
||||
|
||||
Automatically detects new Minecraft releases and posts them to a subreddit.
|
||||
Version 1.0.0 - Automatically detects new Minecraft releases (Java and Bedrock editions) and posts announcements to a subreddit.
|
||||
|
||||
## Features
|
||||
|
||||
- ✅ Checks Minecraft launcher manifest for new releases
|
||||
- ✅ Posts to Reddit whenever a new version is detected
|
||||
- ✅ Tracks posted versions to avoid duplicates
|
||||
- ✅ Runs continuously with configurable check interval
|
||||
- ✅ Supports multiple release types (releases, snapshots, etc.)
|
||||
- ✅ **Bedrock Edition support** - Detects Windows Bedrock releases
|
||||
- ✅ Docker & Docker Compose ready
|
||||
- ✅ **Customizable post templates via subreddit wiki**
|
||||
- ✅ **Different post formats for different release types**
|
||||
- ✅ **Auto-update notifications** - Gets alerted when new bot versions are available
|
||||
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
|
||||
|
||||
## Quick Start - Docker (Recommended)
|
||||
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
|
||||
|
||||
```bash
|
||||
# Copy and edit environment file
|
||||
copy .env.example .env
|
||||
# Edit .env with your Reddit credentials
|
||||
## Quick Start
|
||||
|
||||
# Start the bot
|
||||
docker-compose up -d
|
||||
### Docker (Recommended)
|
||||
|
||||
# View logs
|
||||
docker-compose logs -f
|
||||
```
|
||||
1. Copy the environment template:
|
||||
```bash
|
||||
copy .env.example .env
|
||||
```
|
||||
|
||||
2. Edit `.env` with your Reddit credentials:
|
||||
```
|
||||
REDDIT_CLIENT_ID=your_id
|
||||
REDDIT_CLIENT_SECRET=your_secret
|
||||
REDDIT_USERNAME=your_username
|
||||
REDDIT_PASSWORD=your_password
|
||||
SUBREDDIT=your_subreddit
|
||||
```
|
||||
|
||||
3. Start the bot:
|
||||
```bash
|
||||
docker-compose up -d
|
||||
```
|
||||
|
||||
4. View logs:
|
||||
```bash
|
||||
docker-compose logs -f
|
||||
```
|
||||
|
||||
See [DOCKER.md](DOCKER.md) for detailed Docker setup instructions.
|
||||
|
||||
## Customizing Posts with Wiki Configuration
|
||||
### Manual Setup
|
||||
|
||||
The bot loads post templates from your subreddit's wiki page `minecraft_update_bot`. This allows you to:
|
||||
- Create different post formats for releases vs. snapshots
|
||||
- Customize titles and bodies without restarting
|
||||
- Support legacy version types with custom messages
|
||||
1. Install dependencies:
|
||||
```bash
|
||||
pip install -r requirements.txt
|
||||
```
|
||||
|
||||
**Quick Setup:**
|
||||
1. Create a wiki page named `minecraft_update_bot` on your subreddit
|
||||
2. Add YAML configuration with your templates (see example below)
|
||||
3. Bot auto-loads every 30 minutes
|
||||
2. Create a Reddit application at https://www.reddit.com/prefs/apps (select "Script" type)
|
||||
|
||||
3. Configure environment variables or edit config.py:
|
||||
```bash
|
||||
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:
|
||||
|
||||
**Simple Example:**
|
||||
```yaml
|
||||
release:
|
||||
title: "Minecraft {version} Released!"
|
||||
title: "Minecraft {version} Released"
|
||||
body: |
|
||||
# Minecraft {version}
|
||||
Available now! Get it at [minecraft.net](https://minecraft.net)
|
||||
**Released:** {release_date}
|
||||
New version available at minecraft.net
|
||||
Released: {release_date}
|
||||
|
||||
snapshot:
|
||||
title: "Minecraft {version} Snapshot"
|
||||
body: |
|
||||
# New Snapshot Available
|
||||
Test {version} before the official release!
|
||||
Test build available in launcher
|
||||
Released: {release_date}
|
||||
|
||||
bedrock-windows:
|
||||
title: "Bedrock Edition {version} Available"
|
||||
body: |
|
||||
Download from Microsoft Store
|
||||
Released: {release_date}
|
||||
```
|
||||
|
||||
👉 See [WIKI_CONFIG.md](WIKI_CONFIG.md) for complete setup and examples.
|
||||
Available placeholders: {version}, {release_date}, {type}
|
||||
|
||||
See [WIKI_CONFIG.md](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 in addition to Java Edition.
|
||||
The bot can track Minecraft Bedrock Edition (Windows) releases by scraping the official minecraft.wiki version history page.
|
||||
|
||||
**To enable Bedrock tracking:**
|
||||
|
||||
1. **With Docker:** Add to your `.env` file:
|
||||
```
|
||||
CHECK_BEDROCK=true
|
||||
```
|
||||
|
||||
2. **Manual:** Set environment variable before running:
|
||||
```bash
|
||||
set CHECK_BEDROCK=true
|
||||
python main.py
|
||||
```
|
||||
|
||||
3. **Configure Bedrock posts** in your wiki page (optional):
|
||||
```yaml
|
||||
bedrock-windows:
|
||||
title: "Minecraft Bedrock {version} Available (Windows)"
|
||||
body: |
|
||||
# Bedrock Edition {version}
|
||||
Download from the Microsoft Store
|
||||
**Released:** {release_date}
|
||||
```
|
||||
|
||||
The bot will now check for both Java and Bedrock releases every cycle, posting about each separately.
|
||||
|
||||
## Manual Setup
|
||||
|
||||
### 1. Install Dependencies
|
||||
|
||||
```bash
|
||||
pip install -r requirements.txt
|
||||
Enable with Docker:
|
||||
```env
|
||||
REDDIT_CHECK_BEDROCK=true
|
||||
```
|
||||
|
||||
### 2. Create Reddit Application
|
||||
|
||||
1. Go to [https://www.reddit.com/prefs/apps](https://www.reddit.com/prefs/apps)
|
||||
2. Click "Create an app" or "Create another app"
|
||||
3. Fill in the form:
|
||||
- **Name:** MinecraftUpdateBot
|
||||
- **App type:** Script
|
||||
- **Redirect URI:** http://localhost:8080
|
||||
4. Copy the credentials
|
||||
|
||||
### 3. Configure the Bot
|
||||
|
||||
Edit `config.py` and fill in your credentials:
|
||||
|
||||
```python
|
||||
REDDIT_CLIENT_ID = "YOUR_CLIENT_ID" # From app page
|
||||
REDDIT_CLIENT_SECRET = "YOUR_CLIENT_SECRET" # From app page
|
||||
REDDIT_USERNAME = "YOUR_USERNAME" # Your Reddit username
|
||||
REDDIT_PASSWORD = "YOUR_PASSWORD" # Your Reddit password
|
||||
SUBREDDIT = "YOUR_SUBREDDIT" # Subreddit to post to
|
||||
```
|
||||
|
||||
Or use environment variables (Docker-friendly):
|
||||
|
||||
Or environment variable:
|
||||
```bash
|
||||
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
|
||||
set REDDIT_CHECK_BEDROCK=true
|
||||
python main.py
|
||||
```
|
||||
|
||||
### 4. Customize (Optional)
|
||||
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.
|
||||
|
||||
In `config.py`:
|
||||
- **RELEASE_TYPES:** Change `["release"]` to include snapshots or other types
|
||||
- Options: `"release"`, `"snapshot"`, `"old_beta"`, `"old_alpha"`
|
||||
- **CHECK_INTERVAL:** How often to check for updates (in seconds)
|
||||
- Default: 3600 (1 hour)
|
||||
- **POST_TEMPLATE:** Customize the post format
|
||||
## Release Types
|
||||
|
||||
Examples:
|
||||
```python
|
||||
# Check for both releases and snapshots
|
||||
RELEASE_TYPES = ["release", "snapshot"]
|
||||
Supported Java Edition release types:
|
||||
- release - Final Java Edition releases
|
||||
- snapshot - Development snapshots
|
||||
- old_beta - Legacy beta versions
|
||||
- old_alpha - Legacy alpha versions
|
||||
|
||||
# Check every 30 minutes
|
||||
CHECK_INTERVAL = 1800
|
||||
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-db` then restart
|
||||
- Manual: Delete DB/posted_versions.json
|
||||
|
||||
## Logs
|
||||
|
||||
Docker logs:
|
||||
```bash
|
||||
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
|
||||
|
||||
Reference in New Issue
Block a user