Files
Modreplybot/README.md
T

112 lines
3.3 KiB
Markdown
Raw Normal View History

2026-03-08 18:08:24 +00:00
2026-03-10 18:37:11 +00:00
# ModReplyBot
ModReplyBot is a Reddit bot for moderators that automates post approval and stickied comments based on subreddit wiki configuration. It responds to mod comments and mod reports containing trigger phrases, and auto-comments on posts with configured tags. All configuration is managed via a subreddit wiki page and environment variables.
2026-03-08 18:08:24 +00:00
## Features
2026-03-10 18:37:11 +00:00
- Responds to moderator comments containing trigger phrases (starting with `!`)
- Responds to moderator reports containing trigger phrases (starting with `!`)
2026-03-08 18:08:24 +00:00
- Approves posts and leaves stickied comments
2026-03-10 18:37:11 +00:00
- Posts automatic comments based on tags in post titles (e.g., `[Bedrock]`, `[Java]`)
2026-03-08 23:28:58 +00:00
- Triggers, tag comments, and bot config are managed via a subreddit wiki page
2026-03-10 18:37:11 +00:00
- Notifies mods via modmail when the config wiki page changes or is invalid
2026-03-08 23:28:58 +00:00
- Persistent database for auto-commented posts (survives restarts and container recreations)
2026-03-08 18:08:24 +00:00
- Docker and baremetal support
## Configuration
2026-03-08 23:28:58 +00:00
### 1. Wiki Page Configuration
Edit your subreddit wiki page (name set by `REDDIT_WIKI_PAGE` env variable) with YAML like:
2026-03-08 18:08:24 +00:00
```
triggers:
- trigger: help
comment: |
Thank you for your report!
This post is now approved.
2026-03-10 18:37:11 +00:00
status: enabled
- trigger: wc
2026-03-08 18:08:24 +00:00
comment: |
2026-03-10 18:37:11 +00:00
Welcome to the community!
status: log-only
2026-03-08 23:28:58 +00:00
post_tags:
- tag: Bedrock, Java
comment: |
__[Click here if your post says "Sorry, this post was removed by Reddits filters"](...)__
2026-03-10 18:37:11 +00:00
status: enabled
2026-03-08 18:08:24 +00:00
```
2026-03-10 18:37:11 +00:00
- Triggers: Bot responds to mod comments and mod reports containing `!trigger` (e.g., `!help`) with the configured comment.
2026-03-08 23:28:58 +00:00
- post_tags: Bot posts the comment automatically on new posts with matching tags in the title.
2026-03-10 18:37:11 +00:00
- Status options: `enabled`, `log-only`, `disabled`.
2026-03-08 18:08:24 +00:00
### 2. Environment Variables
Create a `.env` file (or set env variables directly) with:
2026-03-10 18:37:11 +00:00
2026-03-08 18:08:24 +00:00
```
REDDIT_CLIENT_ID=your_client_id
REDDIT_CLIENT_SECRET=your_client_secret
REDDIT_USERNAME=your_username
REDDIT_PASSWORD=your_password
2026-03-08 18:16:19 +00:00
REDDIT_USER_AGENT=modreplybot by /u/your_username
2026-03-08 18:08:24 +00:00
REDDIT_SUBREDDIT=your_subreddit
2026-03-10 18:37:11 +00:00
REDDIT_WIKI_PAGE=modreplybot-config
LOG_LEVEL=Default
2026-03-08 18:08:24 +00:00
```
2026-03-10 18:37:11 +00:00
docker compose up -d
docker run --env-file .env -v $(pwd)/DB:/app/DB slfhstd.uk/slfhstd/modreplybot:latest
pip install -r requirements.txt
2026-03-08 18:08:24 +00:00
## Installation
### Docker Compose (Recommended)
1. Copy `.env.example` to `.env` and fill in your values.
2. Run:
```
docker compose up -d
```
2026-03-10 18:37:11 +00:00
* The DB folder is mounted for persistent database storage.
2026-03-08 23:28:58 +00:00
2026-03-08 18:08:24 +00:00
### Docker Run
1. Copy `.env.example` to `.env` and fill in your values.
2. Run:
```
2026-03-08 23:28:58 +00:00
docker run --env-file .env -v $(pwd)/DB:/app/DB slfhstd.uk/slfhstd/modreplybot:latest
2026-03-08 18:08:24 +00:00
```
### Baremetal (Direct Python)
1. Install Python 3.11+
2. Install dependencies:
```
pip install -r requirements.txt
```
3. Set environment variables or create a `.env` file.
4. Run:
```
2026-03-08 23:28:58 +00:00
python modreplybot.py
2026-03-08 18:08:24 +00:00
```
2026-03-10 18:37:11 +00:00
2026-03-08 18:08:24 +00:00
## Troubleshooting
- Ensure your Reddit credentials are correct and have moderator permissions.
- The bot must be able to read the wiki page and approve posts.
- Check logs for errors.
2026-03-10 18:37:11 +00:00
- The bot only responds to mod comments and mod reports for triggers.
2026-03-08 23:28:58 +00:00
- Database is stored in DB/commented_posts.txt and survives container restarts.
2026-03-10 18:37:11 +00:00
- If the wiki config is invalid, the bot will notify mods via modmail and pause until fixed.
## Moderator Guide
See `ModGuide.md` for a detailed guide to configuring triggers, auto-post tags, and wiki options.
2026-03-08 18:08:24 +00:00
## License
MIT