Ragnar Bot: Automated Moderation System for Devrant.io
Overview
Ragnar Bot is an automated system designed to interact with the Devrant.io API for community moderation. It detects spam, flags inappropriate content, and takes corrective actions such as downvoting and commenting. The system is scalable, customizable, and supports concurrent operations for multiple users.
Features
API Integration
- User Authentication: Secure login with credentials.
- Profile Retrieval: Access user profile data.
- Content Search: Find posts matching specific keywords or patterns.
- Comments Management: Post and fetch comments on rants.
- Voting System: Upvote or downvote rants programmatically.
- Fetch Rants: Retrieve and sort recent rants for analysis.
Spam Detection
- Keyword Triggers: Detect spam using predefined keywords like
crypto
,bitcoin
, and more. - Regex Matching: Identify suspicious patterns in text, such as URLs or phone numbers.
- Heuristic Checks: Evaluate user profiles and comments for unusual behavior.
Automation
- Flagging Spam: Automatically downvote and comment on posts flagged as spam.
- Concurrent Execution: Operates multiple bots simultaneously using multithreading.
- Customizable Triggers: Adjust detection patterns to fit evolving spam trends.
Logging & Caching
- Logging: Outputs activity logs to both the console and a file for debugging and monitoring.
- Caching: Uses a custom caching system to optimize performance and reduce redundant operations.
How It Works
Components
-
API: Handles all interactions with the Devrant.io platform, including user authentication, content retrieval, and posting actions.
-
Bot: Implements moderation logic:
- Identifies suspicious content.
- Posts comments warning users about flagged content.
- Maintains a history of checked rants to avoid redundant processing.
-
CLI: Command-line interface to configure and execute the bot. Accepts user credentials and runs bots for multiple users simultaneously.
-
Victoria Integration: Fetches user-related data from a remote service (
victoria.molodetz.nl
) for enhanced operations.
Workflow
- The bot authenticates using the provided username and password.
- It retrieves and evaluates recent rants for spam indicators.
- If spam is detected:
- Posts a predefined warning comment.
- Downvotes the rant.
- Maintains logs and runs continuously to monitor new rants.
Installation & Usage
-
Setup: Clone the repository and ensure all dependencies are installed.
-
Run the Bot: Execute the bot via the CLI:
python cli.py -u <username> -p <password>
Fan art
This is some fan art made by Buffon, a contributor of this project:
Another one:
Third one, the legendary bot war of 2024 ended in peace.
.gitea/workflows | |
dist | |
src | |
.gitignore | |
app.log | |
buffon2.jpg | |
buffon3.jpg | |
buffon.jpg | |
logtest.py | |
Makefile | |
pyproject.toml | |
README.md | |
setup.cfg | |
sudo | |
tiggers.js |