92 lines
2.1 KiB
Markdown
92 lines
2.1 KiB
Markdown
|
|
# ModBot 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 subreddit wiki page. 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 subreddit wiki
|
||
|
|
- Supports multiple triggers/comments
|
||
|
|
- Docker and baremetal support
|
||
|
|
|
||
|
|
## Configuration
|
||
|
|
|
||
|
|
### 1. Subreddit Wiki Page
|
||
|
|
Create a wiki page (e.g. `modbot-config`) in your subreddit using Automoderator YAML format. 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.
|
||
|
|
|
||
|
|
### 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=modbot by /u/your_username
|
||
|
|
REDDIT_SUBREDDIT=your_subreddit
|
||
|
|
REDDIT_WIKI_PAGE=modbot-config
|
||
|
|
```
|
||
|
|
|
||
|
|
## 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
|