v0.2
Just another Node.js bot that automatically cross-posts design-related content from Stacker News/~Design to Twitter and Nostr, tagging authors if they include their handles. Helping spread design inspiration across multiple social platforms, one note at time.
- Multi-Platform Posting: Automatically posts to Twitter and Nostr
- Stacker News Integration: Monitors Stacker News for #Design tagged posts
- Real-time Updates: Uses WebSocket connections for live content monitoring
- Rate Limit Handling: Gracefully handles Twitter API rate limits
Before running D_Bot, you'll need:
- Node.js (v18 or higher)
- Twitter API v2 credentials (Bearer Token, API Key, API Secret, Access Token, Access Token Secret)
- Nostr private key for posting. get yours from Nstart.me
- Stacker News API access
-
Clone the repository
git clone https://github.com/design-rrr/D_Bot.git cd D_Bot
-
Install dependencies
npm install
-
Set up environment variables Create a
.env
file in the root directory:# Twitter API Credentials TWITTER_BEARER_TOKEN=your_bearer_token TWITTER_API_KEY=your_api_key TWITTER_API_SECRET=your_api_secret TWITTER_ACCESS_TOKEN=your_access_token TWITTER_ACCESS_TOKEN_SECRET=your_access_token_secret # Nostr Configuration NOSTR_PRIVATE_KEY=your_nostr_private_key # Server Configuration PORT=10000
node D_Poster.js
The bot is configured for deployment with the following settings:
- Build Command:
npm install
- Start Command:
node D_Poster.js
- Environment: Node.js
D_Bot/
├── D_Poster.js # Main application file
├── package.json # Node.js dependencies
├── .env # Environment variables (not in repo)
└── README.md # This file
- Create a Twitter Developer account
- Create a new app in the Twitter Developer Portal
- Generate API keys and tokens
- Add credentials to your environment variables
- Generate a Nostr private key
- Add the private key to your environment variables
- The bot will automatically derive the public key
- Twitter Basic Plan: 17 tweets per 24 hours
- Twitter Basic Paid: 10,000 tweets per month
- The bot includes automatic rate limit handling
- Monitoring: The bot connects to Stacker News via WebSocket
- Filtering: Monitors for new posts tagged with #Design
- Processing: Extracts post title, author, and link
- Cross-posting:
- Posts to Nostr with formatted message
- Posts to Twitter (if not rate limited)
- Error Handling: Gracefully handles API errors and rate limits
If you see EADDRINUSE
error:
- The bot uses
process.env.PORT
for online deployment compatibility - Locally defaults to port 10000
- Ensure no other services are using the same port
- Free tier: 17 requests per 24 hours
- Consider upgrading your Twitter API plan for higher limits
- The bot will continue posting to Nostr even when Twitter is rate limited
If you see "already declared" errors:
- Check for duplicate function or variable declarations
- Common culprits:
postToTwitter
,PORT
,server
variables
- Configure Service:
- Environment: Node.js
- Build Command:
npm install
- Start Command:
node D_Poster.js
- Set Environment Variables: Add all required API keys and tokens
The bot provides console logging for:
- Successful posts to each platform
- Rate limit notifications
- Error messages and debugging info
- WebSocket connection status
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature
) - Commit your changes (
git commit -m 'Add amazing feature'
) - Push to the branch (
git push origin feature/amazing-feature
) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
If you encounter issues:
- Check the console logs for error messages
- Verify all environment variables are set correctly
- Ensure API credentials are valid and have proper permissions
- Check rate limits on your Twitter API plan
Built with ❤️ for the design community