Goal Bot is a Python-based Reddit bot that monitors the r/soccer subreddit for posts related to Premier League goals. It identifies relevant posts, checks for duplicate scores, and posts updates to a Discord channel.
- Monitors r/soccer subreddit for new posts
- Identifies posts containing goal-related keywords and Premier League team names
- Advanced duplicate detection:
- Exact URL matches within 30s
- Exact score/minute/scorer matches within 60s (handles name variations)
- Similar minute matches (±1) within 120s
- Fetches direct video links from supported sites:
- streamff.com / streamff.live
- streamin.one / streamin.fun
- dubz.link
- Posts updates to Discord:
- Direct MP4 links for video files
- Rich embeds for regular links with team colors and logos
- Automatic retry mechanism for failed video extractions
- Comprehensive logging with status indicators
- Rate limit monitoring for Reddit API
- Test modes for development and debugging
- Python 3.9+
- Docker (optional)
The bot can be configured using environment variables in your .env
file:
# Reddit API Configuration
CLIENT_ID=your_client_id
CLIENT_SECRET=your_client_secret
USER_AGENT=your_user_agent
# Discord Configuration
DISCORD_WEBHOOK_URL=your_discord_webhook_url
DISCORD_USERNAME=your_webhook_username # Optional: defaults to 'Ally'
DISCORD_AVATAR_URL=your_webhook_avatar_url # Optional: defaults to preset image
# Bot Settings
POST_AGE_MINUTES=5 # Optional: defaults to 5
LOG_LEVEL=INFO # Optional: defaults to INFO
Additional configuration options are available in the code:
- Goal detection keywords and patterns
- Premier League team names and aliases
- Supported video hosting sites
- Score matching patterns
- Duplicate detection time windows
-
Clone the repository:
git clone https://github.com/fenneh/discord-epl-goal-clips.git cd discord-epl-goal-clips
-
Create a
.env
file with your configuration (see above) -
Install the required Python packages:
pip install -r requirements.txt
-
Install development dependencies (optional):
pip install -r requirements-dev.txt
Start the bot:
python -m src.main
The bot will:
- Monitor r/soccer for new Premier League goal posts
- Extract video links and check for duplicates
- Post updates to Discord with direct MP4 links when possible
Run the test suite:
# Windows
.\run_tests.ps1
# Linux/Mac
./run_tests.sh
Test specific functionality:
# Test posts from last X hours
python -m src.main --test-hours 24
# Test specific Reddit threads
python -m src.main --test-threads "abc123,xyz789"
# Test with duplicate checking disabled
python -m src.main --ignore-duplicates
The bot uses structured logging with clear status indicators:
[INFO]
- General information and successful operations[SKIP]
- Posts that were skipped with reason[DUPLICATE]
- Detailed duplicate detection information
Logs include:
- Timestamps
- Reddit and video URLs
- Processing status and decisions
- Duplicate detection details
- Enhanced duplicate detection with time windows
- Improved player name normalization
- Added comprehensive test suite
- Organized test files into dedicated directory
- Added pytest-asyncio for async test support
- Fixed domain extraction and validation
- Updated README with recent changes and roadmap
- Improved documentation for configuration and usage
-
Support for "miss" posts
- Track near misses and big chances
- Different Discord channel/formatting
-
Support for red card incidents
- Track red cards and second yellows
- Different Discord channel/formatting
- Improve video host reliability
- Add more test coverage
- Monitor and improve duplicate detection accuracy
- Fork the repository
- Create a feature branch
- Make your changes
- Run the test suite
- Submit a pull request
This project is licensed under the MIT License - see the LICENSE file for details.