V2 release

This commit is contained in:
2026-03-10 22:29:35 +00:00
parent 9719a9b5f9
commit 56acc187a9
5 changed files with 414 additions and 157 deletions
+96 -68
View File
@@ -21,91 +21,119 @@ Edit your subreddit wiki page (name set by `REDDIT_WIKI_PAGE` env variable) with
```
triggers:
- trigger: help
comment: |
Thank you for your report!
This post is now approved.
status: enabled
- trigger: wc
comment: |
Welcome to the community!
status: log-only
post_tags:
- tag: Bedrock, Java
comment: |
__[Click here if your post says "Sorry, this post was removed by Reddits filters"](...)__
status: enabled
```
# ModReplyBot
- Triggers: Bot responds to mod comments and mod reports containing `!trigger` (e.g., `!help`) with the configured comment.
- post_tags: Bot posts the comment automatically on new posts with matching tags in the title.
- Status options: `enabled`, `log-only`, `disabled`.
ModReplyBot is a Reddit bot for moderators that automates post actions and stickied comments based on subreddit wiki configuration. It responds to mod comments and mod reports containing trigger phrases, auto-comments on posts with configured tags, and now supports chat-based config reloads. All configuration is managed via a subreddit wiki page and environment variables.
### 2. Environment Variables
Create a `.env` file (or set env variables directly) with:
## Features
- Responds to moderator comments containing trigger phrases (starting with `!`)
- Responds to moderator reports containing trigger phrases (starting with `!`)
- Sets post flair, locks posts/comments, and posts stickied comments
- Posts automatic comments based on tags in post titles (e.g., `[Bedrock]`, `[Java]`)
- Triggers, tag comments, and bot config are managed via a subreddit wiki page
- Chat-based config reload: send a chat message containing `reload-config` to the bot from a moderator account to reload the wiki config
- Persistent database for auto-commented posts and processed chat requests (survives restarts and container recreations)
- Docker and baremetal support
## Configuration
```
REDDIT_CLIENT_ID=your_client_id
REDDIT_CLIENT_SECRET=your_client_secret
REDDIT_USERNAME=your_username
REDDIT_PASSWORD=your_password
REDDIT_USER_AGENT=modreplybot by /u/your_username
REDDIT_SUBREDDIT=your_subreddit
REDDIT_WIKI_PAGE=modreplybot-config
LOG_LEVEL=Default
```
### 1. Wiki Page Configuration
Edit your subreddit wiki page (name set by `REDDIT_WIKI_PAGE` env variable) with YAML like:
docker compose up -d
docker run --env-file .env -v $(pwd)/DB:/app/DB slfhstd.uk/slfhstd/modreplybot:latest
pip install -r requirements.txt
```
triggers:
- trigger: help
comment: |
Thank you for your report!
This post is now approved.
status: enabled
flair_id: 12345678-aaaa-bbbb-cccc-1234567890ab
stickied: true
lock_post: false
lock_comment: false
- trigger: wc
comment: |
Welcome to the community!
status: log-only
## Installation
post_tags:
- tag: Bedrock, Java
comment: |
__[Click here if your post says "Sorry, this post was removed by Reddits filters"](...)__
status: enabled
flair_id: 12345678-aaaa-bbbb-cccc-1234567890ab
```
### Docker Compose (Recommended)
1. Copy `.env.example` to `.env` and fill in your values.
2. Run:
- Triggers: Bot responds to mod comments and mod reports containing `!trigger` (e.g., `!help`) with the configured comment and actions.
- post_tags: Bot posts the comment automatically on new posts with matching tags in the title and can set flair.
- Status options: `enabled`, `log-only`, `disabled`.
- Optional actions: `flair_id`, `stickied`, `lock_post`, `lock_comment`.
```
docker compose up -d
```
### 2. Environment Variables
Create a `.env` file (or set env variables directly) with:
* The DB folder is mounted for persistent database storage.
```
REDDIT_CLIENT_ID=your_client_id
REDDIT_CLIENT_SECRET=your_client_secret
REDDIT_USERNAME=your_username
REDDIT_PASSWORD=your_password
REDDIT_USER_AGENT=modreplybot by /u/your_username
REDDIT_SUBREDDIT=your_subreddit
REDDIT_WIKI_PAGE=modreplybot-config
LOG_LEVEL=Default
```
### Docker Run
1. Copy `.env.example` to `.env` and fill in your values.
2. Run:
## Installation
```
docker run --env-file .env -v $(pwd)/DB:/app/DB slfhstd.uk/slfhstd/modreplybot:latest
```
### Docker Compose (Recommended)
1. Copy `.env.example` to `.env` and fill in your values.
2. Run:
### Baremetal (Direct Python)
1. Install Python 3.11+
2. Install dependencies:
```
docker compose up -d
```
```
pip install -r requirements.txt
```
* The DB folder is mounted for persistent database storage.
3. Set environment variables or create a `.env` file.
4. Run:
### Docker Run
1. Copy `.env.example` to `.env` and fill in your values.
2. Run:
```
python modreplybot.py
```
```
docker run --env-file .env -v $(pwd)/DB:/app/DB slfhstd.uk/slfhstd/modreplybot:latest
```
### Baremetal (Direct Python)
1. Install Python 3.11+
2. Install dependencies:
## 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.
- The bot only responds to mod comments and mod reports for triggers.
- Database is stored in DB/commented_posts.txt and survives container restarts.
- If the wiki config is invalid, the bot will notify mods via modmail and pause until fixed.
```
pip install -r requirements.txt
```
## Moderator Guide
See `ModGuide.md` for a detailed guide to configuring triggers, auto-post tags, and wiki options.
3. Set environment variables or create a `.env` file.
4. Run:
## License
MIT
```
python modreplybot.py
```
## Chat-Based Config Reload
- To reload the wiki config, send a chat message containing `reload-config` to the bot account from a moderator account.
- The bot will reply to the chat message indicating whether the config is valid or not.
- Chat message IDs are tracked in `/DB/chat_wiki_requests.txt` to prevent duplicate reloads after restarts.
## 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.
- The bot only responds to mod comments and mod reports for triggers.
- Database is stored in `/DB/commented_posts.txt` and `/DB/chat_wiki_requests.txt` and survives container restarts.
- If the wiki config is invalid, the bot will reply to the chat message with an error.
## Moderator Guide
See `ModGuide.md` for a detailed guide to configuring triggers, auto-post tags, and wiki options.
## License
MIT