✅ Project builds successfully without errors
- ✅ Updated to use
twitter-api-v2library - ✅ Implements
postSale()method with correct format - ✅ Implements caching to prevent duplicates
- ✅ Has rate limiting protection (1 second between tweets)
- ✅ Injects TwitterService
- ✅ Calls
twitterService.postSale()after posting to Discord - ✅ Has error handling so Twitter failures don't affect Discord
- ✅ Twitter API keys are configured via environment variables:
TWITTER_CONSUMER_KEYTWITTER_CONSUMER_SECRETTWITTER_ACCESS_KEYTWITTER_ACCESS_SECRET
When running in development mode (APP_ENVIRONMENT=development), the Twitter service will:
- Log what would be tweeted without actually posting
- Still cache the "posts" to prevent log spam
- Show format:
[DEV MODE] Would tweet: {message}
NAME OF TOKEN (#ID) sold for 0.02 ETH ($74.31 USD)!
Example:
Wizard #12345 sold for 0.02 ETH ($74.31 USD)!
- Cron job runs every minute (configurable via
SALES_CHECK_CRON) AppServicetriggersDiscordService.checkSales()ForgottenMarketService.getSales()fetches recent sales- For each sale:
- Posts to Discord channels
- Posts to Twitter
- Both use caching to prevent duplicates
Watch the logs for:
Running Sales Checker Job- Indicates cron is runningPosting sale to discord: {cacheKey}- Sale being processedPosting sale to Twitter: {cacheKey}- Twitter post attempt[DEV MODE] Would tweet: {message}- Development mode outputSuccessfully tweeted: {id} - {message}- Production success
- Twitter API v2 has rate limits
- Implementation includes 1 second delay between tweets
- Errors are logged but don't stop the process