Tutorials
Step-by-step guides for common RedHarmony tasks.
Creating Your First Persona
Basic Persona Setup
- Open
accounts.json
:
[
{
"subreddits": ["python", "learnpython"],
"prompt": "You are a helpful Python developer..."
}
]
- Define personality traits:
{
"prompt": "You are a helpful Python developer with 5 years of experience. You enjoy explaining complex concepts in simple terms. Your communication style is friendly and encouraging, often using code examples to illustrate points..."
}
- Test your persona:
python main.py --test-persona 0
Advanced Persona Configuration
Create a more complex persona:
{
"subreddits": ["python", "learnpython", "programming"],
"prompt": "You are a senior Python developer...",
"interaction_style": "technical",
"knowledge_areas": ["python", "algorithms", "data_structures"],
"response_patterns": {
"questions": "detailed_with_examples",
"discussions": "analytical",
"help_requests": "step_by_step"
}
}
Customizing Rate Limits
- Open
main.py
- Locate the rate limit section:
daily_post_limit = 20
daily_comment_limit = 100
hourly_post_limit = 2
hourly_comment_limit = 5
- Adjust values based on your needs:
# Example for lower frequency
daily_post_limit = 10
daily_comment_limit = 50
hourly_post_limit = 1
hourly_comment_limit = 3
Setting Up Multiple Subreddits
- Identify target subreddits
- Update
accounts.json
:
[
{
"subreddits": [
"python",
"learnpython",
"djangolearning",
"flask"
],
"prompt": "You are a Python web developer..."
}
]
- Test subreddit access:
from utils.helper import subreddit_valid
for subreddit in account["subreddits"]:
if not subreddit_valid(reddit, subreddit):
print(f"Cannot access: {subreddit}")
Implementing Custom Vote Behavior
- Create a voting strategy:
# utils/vote.py
def custom_vote_strategy(content_type, score):
if content_type == "post":
if score < 0:
return "up"
return "none"
elif content_type == "comment":
if score < -2:
return "up"
return "none"
- Integrate with voting system:
def vote_post(post):
vote_action = custom_vote_strategy("post", post.score)
if vote_action == "up":
post.upvote()
elif vote_action == "down":
post.downvote()
Monitoring and Analytics
- Create a monitoring script:
# monitor.py
from utils.database import get_db_connection
def analyze_activity():
conn = get_db_connection()
cursor = conn.cursor()
# Get post statistics
cursor.execute("""
SELECT
COUNT(*) as post_count,
AVG(score) as avg_score
FROM posts
WHERE date(timestamp) = date('now')
""")
# Print results
results = cursor.fetchone()
print(f"Today's Stats:")
print(f"Posts: {results[0]}")
print(f"Average Score: {results[1]}")
- Run monitoring:
python monitor.py