0e70503a3be6d8db4f85cd8463e6bd099b90cd46
FlairTimerModMail
FlairTimerModMail is a Reddit bot designed to monitor new posts in a specified subreddit for a particular flair. When a post receives the target flair, the bot starts a timer. If the flair remains on the post for a configurable number of hours, the bot sends a modmail notification to the subreddit moderators. This tool is useful for subreddits that use flairs to track posts requiring moderator attention or follow-up.
Features
- Monitors new posts in a subreddit for a specific flair
- Tracks how long a post has had the flair
- Sends a modmail notification after a configurable time period
- Configurable via environment variables or a config file
- Supports running natively with Python or in Docker (standalone or with Docker Compose)
Requirements
- Python 3.8+
- Reddit API credentials (see below)
Configuration
The bot can be configured using a config/config.py file or via environment variables. When running in Docker, environment variables are recommended and can be managed with a .env file.
Required Configuration Values
USERNAME: Reddit usernamePASSWORD: Reddit passwordCLIENT_ID: Reddit API client IDCLIENT_SECRET: Reddit API client secretUSER_AGENT: User agent string for Reddit APISUBREDDIT: Subreddit to monitorFLAIR_TEXT: Flair text to track (case sensitive)INTERVAL: How often to scan (seconds)HOURS: How many hours before sending notificationMESSAGETITLE: Title for the modmail messageSEARCHLIMIT: How many posts to scan (max 1000)
Installation & Usage
1. Python (Native)
- Clone the repository:
git clone https://github.com/slfhstd/FlairTimerModMail.git cd FlairTimerModMail - Install dependencies:
pip install -r requirements.txt - Copy
example.envto.envand fill in your Reddit credentials and settings, or editconfig/config.pydirectly. - Run the bot:
python flairtimermodmail.py
2. Docker Run
- Copy
example.envto.envand fill in your values. - Run the bot with Docker:
docker run --env-file .env -v $(pwd)/config:/app/config ghcr.io/slfhstd/flairtimermodmail:latest
3. Docker Compose
- Clone the repository:
git clone https://github.com/slfhstd/FlairTimerModMail.git cd FlairTimerModMail - Copy
example.envto.envand fill in your values. - Start the bot with Docker Compose:
docker-compose up -d
Notes
- The bot will auto-generate a config file from environment variables if one does not exist.
- Make sure your Reddit account has the necessary permissions and API credentials.
- For production use, keep your credentials secure and do not commit
.envfiles with real secrets to version control.
License
This project is provided as-is under the MIT License.
Description
Languages
Python
96.8%
Dockerfile
3.2%