176 lines
3.9 KiB
Markdown
176 lines
3.9 KiB
Markdown
# Quick Start Guide
|
|
|
|
## Installation
|
|
|
|
### Docker (Recommended)
|
|
|
|
1. Copy environment template:
|
|
```bash
|
|
copy .env.example .env
|
|
```
|
|
|
|
2. Edit `.env` with credentials:
|
|
```
|
|
REDDIT_CLIENT_ID=your_client_id
|
|
REDDIT_CLIENT_SECRET=your_client_secret
|
|
REDDIT_USERNAME=your_username
|
|
REDDIT_PASSWORD=your_password
|
|
SUBREDDIT=your_subreddit
|
|
```
|
|
|
|
3. Start the bot:
|
|
```bash
|
|
docker-compose up -d
|
|
```
|
|
|
|
4. Check logs:
|
|
```bash
|
|
docker-compose logs -f
|
|
```
|
|
|
|
### Manual Installation
|
|
|
|
1. Install dependencies:
|
|
```bash
|
|
pip install -r requirements.txt
|
|
```
|
|
|
|
2. Create Reddit app at https://www.reddit.com/prefs/apps (select "Script" type)
|
|
|
|
3. Set environment variables:
|
|
```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
|
|
```
|
|
|
|
4. Run the bot:
|
|
```bash
|
|
python main.py
|
|
```
|
|
|
|
## Configuration
|
|
|
|
Required env vars:
|
|
- REDDIT_CLIENT_ID
|
|
- REDDIT_CLIENT_SECRET
|
|
- REDDIT_USERNAME
|
|
- REDDIT_PASSWORD
|
|
- SUBREDDIT
|
|
|
|
Optional env vars:
|
|
- REDDIT_RELEASE_TYPES (default: release)
|
|
- Examples: "release", "release,snapshot"
|
|
- REDDIT_CHECK_BEDROCK (default: false)
|
|
- Set to "true" to enable Bedrock Edition detection
|
|
- REDDIT_CHECK_INTERVAL (default: 3600)
|
|
- Number of seconds between version checks
|
|
- REDDIT_WIKI_PAGE_NAME (default: minecraft_update_bot)
|
|
- Wiki page name for post templates
|
|
|
|
## Wiki Configuration
|
|
|
|
Create a wiki page named minecraft_update_bot on your subreddit with YAML content:
|
|
|
|
```yaml
|
|
release:
|
|
title: "Minecraft {version} Released"
|
|
body: |
|
|
New version available!
|
|
**Version:** {version}
|
|
**Released:** {release_date}
|
|
|
|
snapshot:
|
|
title: "Minecraft {version} Snapshot"
|
|
body: |
|
|
New snapshot available for testing!
|
|
**Version:** {version}
|
|
**Released:** {release_date}
|
|
```
|
|
|
|
Placeholders: {version}, {release_date}, {type}
|
|
|
|
See WIKI_CONFIG.md for complete examples.
|
|
|
|
## Testing
|
|
|
|
### Manual Version Checker Test
|
|
|
|
```bash
|
|
python -c "from minecraft_checker import get_latest_releases; import json; print(json.dumps(get_latest_releases(['release']), indent=2))"
|
|
```
|
|
|
|
### Bedrock Checker Test
|
|
|
|
```bash
|
|
python -c "from bedrock_checker import get_latest_bedrock_release; import json; result = get_latest_bedrock_release(); print(json.dumps(result, indent=2))"
|
|
```
|
|
|
|
### Full Configuration Test
|
|
|
|
```bash
|
|
python test_setup.py
|
|
```
|
|
|
|
Expected output:
|
|
- Configuration loaded successfully
|
|
- Minecraft API reachable
|
|
- Reddit connection working
|
|
- Wiki configuration loaded
|
|
|
|
## Moderator Commands
|
|
|
|
Send these messages via Reddit chat to control the bot:
|
|
|
|
**reload-config**
|
|
- Reloads wiki configuration without restarting
|
|
- Usage: Send a chat message containing "reload-config"
|
|
|
|
**repost-latest**
|
|
- Manually repost latest versions (bypasses duplicate check)
|
|
- Usage: Send a chat message containing "repost-latest"
|
|
|
|
Note: Only subreddit moderators can use these commands.
|
|
|
|
## File Overview
|
|
|
|
- main.py - Bot orchestration and command handler
|
|
- config.py - Configuration loader
|
|
- minecraft_checker.py - Java Edition version checker
|
|
- bedrock_checker.py - Bedrock Edition version checker
|
|
- wiki_config.py - Wiki configuration manager
|
|
- update_checker.py - Bot update checker
|
|
- requirements.txt - Python dependencies
|
|
- Dockerfile - Container image
|
|
- docker-compose.yml - Docker composition
|
|
- DB/ - Version tracking database
|
|
|
|
## Logs
|
|
|
|
Docker:
|
|
```bash
|
|
docker-compose logs -f
|
|
```
|
|
|
|
Manual:
|
|
```
|
|
Watch console output for [BOT], [CHAT], [BEDROCK_CHECKER] messages
|
|
```
|
|
|
|
## Common Issues
|
|
|
|
No posts appearing:
|
|
- Check logs for errors
|
|
- Verify subreddit name in REDDIT_SUBREDDIT
|
|
- Check DB/posted_versions.json for version tracking
|
|
|
|
Bot not detecting Bedrock:
|
|
- Ensure REDDIT_CHECK_BEDROCK is set to true
|
|
- Check bedrock_checker logs for wiki scraping errors
|
|
|
|
Wiki config not loading:
|
|
- Verify wiki page name is exactly "minecraft_update_bot"
|
|
- Ensure YAML syntax is valid
|