A Discord bot that aggregates payment industry news from RSS feeds, uses AI to summarize and categorize articles, and delivers daily digests.
🚀 Status: Deployed and running 24/7 on Railway 📦 Repository: https://github.com/ratanon97/PaymentNewsDiscordBot
- Fetches news from Finextra Payments and Payments Dive RSS feeds
- AI-powered article summarization using Anthropic's Claude (claude-3-5-sonnet-20240620)
- Automatic categorization (Global vs Thailand-specific)
- Discord embeds with rich formatting and emoji reactions
- Daily scheduled digests at 8 AM Bangkok time
- Manual commands for on-demand news
- SQLite database to prevent duplicate articles
- HTML tag stripping and URL cleaning
PaymentNewsBot/
├── bot.py # Discord bot logic and commands
├── news_fetcher.py # RSS fetching and AI processing
├── database.py # SQLite database operations
├── scheduler.py # Daily digest scheduling
├── config.py # Configuration management
├── requirements.txt # Python dependencies
├── Procfile # Railway deployment configuration
├── runtime.txt # Python version specification
├── .env # Environment variables (create this)
├── .env.example # Environment variables template
├── README.md # This file
├── REQUIREMENTS.md # Technical requirements document
└── SECURITY_IMPROVEMENTS.md # Security documentation
pip install -r requirements.txt- Go to Discord Developer Portal
- Click "New Application" and give it a name
- Go to "Bot" section and click "Add Bot"
- Enable "Message Content Intent" under Privileged Gateway Intents
- Copy the bot token
- Enable Developer Mode in Discord (User Settings > Advanced > Developer Mode)
- Right-click the channel where you want the bot to post
- Click "Copy ID"
- Sign up at Anthropic Console
- Create an API key
Copy .env.example to .env and fill in your credentials:
cp .env.example .envEdit .env:
DISCORD_TOKEN=your_discord_bot_token_here
DISCORD_CHANNEL_ID=your_channel_id_here
ANTHROPIC_API_KEY=your_anthropic_api_key_here
- Go to Discord Developer Portal > Your Application > OAuth2 > URL Generator
- Select scopes:
bot - Select bot permissions:
Send Messages,Read Message History - Copy the generated URL and open it in your browser
- Select your server and authorize
python bot.pypython scheduler.py!digest- Manually trigger a news digest (fetches new articles and displays them)!latest- Show the last 5 articles from the database
This bot is currently deployed and running on Railway!
If you want to deploy your own instance:
git clone https://github.com/ratanon97/PaymentNewsDiscordBot.git
cd PaymentNewsDiscordBot- Go to Railway and sign up/login with GitHub
- Click "New Project" → "Deploy from GitHub repo"
- Select your forked/cloned PaymentNewsBot repository
- Railway will automatically detect your
Procfileandruntime.txt
In your Railway project dashboard:
- Go to "Variables" tab
- Add these three environment variables:
DISCORD_TOKEN= your_discord_bot_tokenDISCORD_CHANNEL_ID= your_channel_idANTHROPIC_API_KEY= your_anthropic_api_key
Railway will automatically deploy your bot after adding the environment variables. Check the deployment logs to ensure it started successfully.
- Railway uses the
Procfileto know how to run your app - The bot runs as a "worker" process (not a web server)
- The database file will persist across deployments
- Check logs via Railway dashboard if you encounter issues
- The bot will restart automatically if it crashes
Railway offers:
- $5 free credit per month (sufficient for a small Discord bot)
- Pay-as-you-go pricing after free credits
- This bot typically uses minimal resources (~$5-10/month)
Currently configured feeds in config.py:
- Finextra Payments: https://www.finextra.com/rss/channel.aspx?channel=payments
- Payments Dive: https://www.paymentsdive.com/feeds/news/
Edit config.py to customize:
- RSS feed sources (add/remove feeds)
- Digest time (default: 08:00 Bangkok time)
- Number of articles shown in
!latestcommand (default: 5) - Command prefix (default:
!) - Anthropic model (current: claude-3-5-sonnet-20240620)
- API timeouts and retry logic
The bot uses SQLite to store articles and prevent duplicates. The database file payment_news.db is created automatically on first run.
- Fetching: Bot fetches articles from configured RSS feeds
- Processing: Each article is sent to Claude API for:
- 2-3 sentence summary
- Categorization (Global or Thailand-specific)
- Storage: Articles are stored in SQLite with deduplication
- Delivery: Articles are formatted and sent to Discord channel
- Scheduling: Daily digest runs automatically at 8 AM Bangkok time
After the basic bot is working, you can add:
- Reaction-based article saving
- User preferences for categories
- Web scraping for non-RSS sources
- Article search functionality
- Analytics and trending topics
Bot doesn't respond to commands:
- Ensure "Message Content Intent" is enabled in Discord Developer Portal
- Check that the bot has permission to read/send messages in the channel
API errors:
- Verify your Anthropic API key is valid and has credits
- Check your Discord token is correct
No articles showing:
- RSS feeds may be down or changed URLs
- Check console for error messages
- Try running
!digestmanually to see detailed errors