This commit is contained in:
parent
52df3887a6
commit
4bf29c87fd
81
examples/princess/README.md
Normal file
81
examples/princess/README.md
Normal file
@ -0,0 +1,81 @@
|
|||||||
|
# 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
|
||||||
|
|
||||||
|
1. **Initialization**: The bot initializes with user credentials, target username, and API keys.
|
||||||
|
2. **Login**: It logs into the platform via the provided API.
|
||||||
|
3. **Content Monitoring**: It fetches recent rants and comments made by the target user.
|
||||||
|
4. **Response Generation**: For new content (not responded to before), it generates a response using a language model (GrokAPIClient).
|
||||||
|
5. **Response Posting**: It prints the content and the generated reply.
|
||||||
|
6. **Tracking**: It records responded messages in a local database to prevent duplicate responses.
|
||||||
|
7. **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
|
||||||
|
|
||||||
|
1. **Create a `.env` file** in the same directory as `princess.py`.
|
||||||
|
2. **Add the required variables** with your credentials and target info:
|
||||||
|
|
||||||
|
```env
|
||||||
|
USERNAME=your_username
|
||||||
|
PASSWORD=your_password
|
||||||
|
TARGET=target_username
|
||||||
|
LLM_KEY=your_grok_api_key
|
||||||
|
```
|
||||||
|
|
||||||
|
3. **Install dependencies** (if not already installed):
|
||||||
|
|
||||||
|
```bash
|
||||||
|
pip install python-dotenv
|
||||||
|
```
|
||||||
|
|
||||||
|
4. **Run the script**:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
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.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
Would you like me to generate the markdown file content as a downloadable file or assist with anything else?
|
Loading…
Reference in New Issue
Block a user