eliza
eliza copied to clipboard
feat: improve Twitter client with action processing
Risks
Low - This PR primarily adds functionality to handle tweet generation and processing with proper error handling and rate limiting in place. Main risks:
- Potential rate limiting from Twitter API if intervals not properly configured
- Memory usage from caching tweets and processing actions
Background
What does this PR do?
Implements a Twitter post client that:
- Generates and posts new tweets on configurable intervals
- Processes tweet actions (likes, retweets, quotes, replies) based on agent personality
- Handles proper truncation of tweets to fit character limits
- Implements caching and rate limiting
- Provides error handling and logging
What kind of change is this?
Features (non-breaking change which adds functionality)
- Adds new TwitterPostClient class
- Implements tweet generation and action processing
- Adds caching and rate limiting controls
Documentation changes needed?
My changes require a change to the project documentation to document:
- Configuration options for post intervals and action processing
- Template customization for tweets and actions
- Rate limiting and caching behavior
Testing
- Configure Twitter credentials in .env
- Initialize client:
const client = new TwitterPostClient(baseClient, runtime);
await client.start();
- Verify tweet generation:
- Check logs for "Generating new tweet"
- Confirm tweet appears on Twitter
- Verify proper truncation to 240 chars
- Test action processing:
- Check logs for "Processing tweet actions"
- Verify likes/retweets/quotes/replies execute
- Confirm rate limiting works
- Verify error handling:
- Test with invalid credentials
- Check error logging
- Confirm graceful failure
Deployment instructions
Requires the following environment variables:
ACTION_INTERVAL
ENABLE_ACTION_PROCESSING
Discord username
dorianjanezic
@odilitime thanks for noticing. Issues resolved.