Princess Bot - Usage and Configuration Guide
Overview
Princess.py is an automated social media interaction bot designed to monitor and respond to specific user-generated content (rants and comments) on a platform. It fetches new posts made by a target user, generates witty or devastating responses using a language model, and keeps track of responded messages to avoid duplicates.
The bot operates continuously, periodically checking for new content and replying accordingly.
How It Works
- Initialization: The bot initializes with user credentials, target username, and API keys.
- Login: It logs into the platform via the provided API.
- Content Monitoring: It fetches recent rants and comments made by the target user.
- Response Generation: For new content (not responded to before), it generates a response using a language model (GrokAPIClient).
- Response Posting: It prints the content and the generated reply.
- Tracking: It records responded messages in a local database to prevent duplicate responses.
- Loop: It repeats this process every 60 seconds.
Configuration
The script uses a .env
file to manage sensitive credentials and configurable properties. Below are the supported environment variables:
Required Environment Variables
Property | Description | Example |
---|---|---|
USERNAME |
Your platform username. | my_username |
PASSWORD |
Your platform password. | my_password |
TARGET |
The username of the user to monitor. | target_user |
LLM_KEY |
API key for the language model (Grok API). | your-grok-api-key |
Setup Instructions
- Create a
.env
file in the same directory asprincess.py
. - Add the required variables with your credentials and target info:
USERNAME=your_username
PASSWORD=your_password
TARGET=target_username
LLM_KEY=your_grok_api_key
- Install dependencies (if not already installed):
pip install python-dotenv
- Run the script:
python princess.py
Notes
- The bot stores responded messages in a local SQLite database (
princess.db
) to avoid duplicate responses. - It runs indefinitely, checking for new content every 60 seconds.
- Make sure your API keys and credentials are kept secure and not shared publicly.
Summary
Princess.py is a social media response bot that:
- Monitors a specific user's posts.
- Generates witty responses using a language model.
- Keeps track of responses to prevent duplicates.
- Runs continuously with minimal setup.