2025-12-28 06:03:12 +01:00
# Princess Bot
Author: retoor < retoor @ molodetz . nl >
An automated social media interaction bot for the devRant platform. Monitors a target user's posts and generates LLM-powered responses.
2025-08-13 00:12:38 +02:00
## Overview
2025-12-28 06:03:12 +01:00
Princess Bot monitors rants and comments from a specified user on devRant, generates contextual responses using the Grok language model, and posts replies automatically. The bot maintains state to prevent duplicate responses.
## Architecture
2025-08-13 00:12:38 +02:00
2025-12-28 06:03:12 +01:00
The bot operates on a polling model with the following components:
2025-08-13 00:12:38 +02:00
2025-12-28 06:03:12 +01:00
| Component | Description |
|-----------|-------------|
| Api | devRant API client for authentication and content retrieval |
| GrokAPIClient | LLM integration for response generation |
| AsyncDataSet | Async SQLite wrapper for state persistence |
2025-08-13 00:12:38 +02:00
2025-12-28 06:03:12 +01:00
## Usage
2025-08-13 00:12:38 +02:00
2025-12-28 06:03:12 +01:00
### Quick Start
```bash
make
```
2025-08-13 00:12:38 +02:00
2025-12-28 06:03:12 +01:00
This creates a virtual environment, installs dependencies, and starts the bot.
2025-08-13 00:12:38 +02:00
2025-12-28 06:03:12 +01:00
### Manual Setup
2025-08-13 00:12:38 +02:00
2025-12-28 06:03:12 +01:00
```bash
python3 -m venv .venv
source .venv/bin/activate
pip install -e ../../.
pip install -r requirements.txt
python princess.py
```
2025-08-13 00:12:38 +02:00
2025-12-28 06:03:12 +01:00
### Configuration
2025-08-13 00:12:38 +02:00
2025-12-28 06:03:12 +01:00
Create a `.env` file with the following variables:
2025-08-13 00:12:38 +02:00
2025-12-28 06:03:12 +01:00
| Variable | Description |
|----------|-------------|
| `USERNAME` | devRant account username |
| `PASSWORD` | devRant account password |
| `TARGET` | Username of the user to monitor |
| `LLM_KEY` | API key for Grok language model |
2025-08-13 00:12:38 +02:00
2025-12-28 06:03:12 +01:00
Example:
2025-08-13 00:12:38 +02:00
```env
USERNAME=your_username
PASSWORD=your_password
TARGET=target_username
LLM_KEY=your_grok_api_key
```
2025-12-28 06:03:12 +01:00
### Stopping
2025-08-13 00:12:38 +02:00
2025-12-28 06:03:12 +01:00
Press `Ctrl+C` to terminate the bot.
2025-08-13 00:12:38 +02:00
2025-12-28 06:03:12 +01:00
## Data Storage
2025-08-13 00:12:38 +02:00
2025-12-28 06:03:12 +01:00
Uses SQLite via AsyncDataSet with:
2025-08-13 00:12:38 +02:00
2025-12-28 06:03:12 +01:00
- Responded message tracking for deduplication
- Persistent state across restarts
2025-08-13 00:12:38 +02:00
2025-12-28 06:03:12 +01:00
## Requirements
2025-08-13 00:12:38 +02:00
2025-12-28 06:03:12 +01:00
- Python 3.10+
- python-dotenv
- aiosqlite
- aiohttp (via parent devranta package)
2025-08-13 00:12:38 +02:00
2025-12-28 06:03:12 +01:00
## Cleanup
2025-08-13 00:12:38 +02:00
2025-12-28 06:03:12 +01:00
```bash
make clean
```
2025-08-13 00:12:38 +02:00
2025-12-28 06:03:12 +01:00
Removes the virtual environment. Database file (`princess.db`) is preserved.
2025-08-13 00:12:38 +02:00
2025-12-28 06:03:12 +01:00
## File Structure
2025-08-13 00:12:38 +02:00
2025-12-28 06:03:12 +01:00
```
princess/
├── princess.py # Main bot implementation
├── ads.py # AsyncDataSet database wrapper
├── grk.py # Grok API client
├── requirements.txt # Dependencies
├── Makefile # Build automation
├── .env # Configuration (create manually)
├── .venv/ # Virtual environment (created on first run)
└── princess.db # SQLite database (created on first run)
```