91 lines
2.1 KiB
Markdown
91 lines
2.1 KiB
Markdown
# ModReplyBot Reddit Bot
|
|
|
|
This bot watches a subreddit for moderator reports containing triggers, approves posts, and leaves stickied comments. Triggers and comments are configured via a local YAML file. All other settings are handled via environment variables.
|
|
|
|
## Features
|
|
- Watches for moderator reports with triggers
|
|
- Approves posts and leaves stickied comments
|
|
- Triggers/comments configured via config/config.yaml
|
|
- Supports multiple triggers/comments
|
|
- Docker and baremetal support
|
|
|
|
## Configuration
|
|
|
|
### 1. Trigger and Comment Configuration
|
|
Edit the file at `config/config.yaml` in your project directory. Example:
|
|
|
|
```
|
|
triggers:
|
|
- trigger: help
|
|
comment: |
|
|
Thank you for your report!
|
|
This post is now approved.
|
|
|
|
- trigger: question
|
|
comment: |
|
|
This post has been approved.
|
|
Your question will be answered soon.
|
|
```
|
|
|
|
Each entry under `triggers` defines a trigger and its associated multi-line comment. The bot will automatically create this file with example content if it does not exist.
|
|
|
|
### 2. Environment Variables
|
|
Create a `.env` file (or set env variables directly) with:
|
|
|
|
```
|
|
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
|
|
```
|
|
|
|
## Installation
|
|
|
|
### Docker Compose (Recommended)
|
|
1. Copy `.env.example` to `.env` and fill in your values.
|
|
2. Run:
|
|
|
|
```
|
|
docker compose up -d
|
|
```
|
|
|
|
### Docker Run
|
|
1. Copy `.env.example` to `.env` and fill in your values.
|
|
2. Run:
|
|
|
|
```
|
|
docker run --env-file .env slfhstd.uk/slfhstd/modreplybot:latest
|
|
```
|
|
|
|
### 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:
|
|
|
|
```
|
|
python modbot.py
|
|
```
|
|
|
|
## Building the Docker Image
|
|
If you want to build your own image:
|
|
|
|
```
|
|
docker build -t modreplybot .
|
|
```
|
|
|
|
## 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.
|
|
|
|
## License
|
|
MIT
|