A Discord bot that posts a daily Forex economic calendar digest and sends 15-minute reminders before high-impact news events. Supports multiple Discord servers.
- Daily digest at 07:00 Berlin time (MonβFri) β lists all upcoming High/Medium impact events for USD, EUR, GBP, and JPY
- 15-minute reminders β automatically fires before each event; no polling, uses a single
setTimeoutper event scheduled at startup - Multi-server support β each server configures its own channel via
/setup - Data source β Forex Factory weekly XML calendar feed
| Command | Permission | Description |
|---|---|---|
/setup #channel |
Manage Server | Set the channel where the bot will post news |
/remove |
Manage Server | Stop the bot from posting on this server |
- Go to discord.com/developers/applications
- New Application β give it a name
- Bot β Reset Token β copy the token
- OAuth2 β URL Generator β check
botandapplications.commandsscopes β checkSend MessagesandEmbed Linkspermissions β open the generated URL to invite the bot to your server
- Create a free cluster at mongodb.com/atlas
- Connect β Drivers β copy the connection string
- Replace
<password>in the URI with your database user password
cp .env.example .envFill in .env:
DISCORD_TOKEN= # Bot token from Discord Developer Portal
CLIENT_ID= # Application ID from Discord Developer Portal (General Information)
MONGODB_URI= # MongoDB Atlas connection stringnpm run deployFor testing, set
DEV_GUILD_IDin.envto your server ID β commands appear instantly instead of taking up to 1 hour globally.
npm startOn your Discord server, run /setup #your-channel. The bot will post the digest every weekday at 07:00 Berlin time.
npm run dev # Start with --watch (auto-restart on file changes)Set RUN_ON_START=true in .env to trigger the morning job immediately on startup β useful for testing the digest and reminder flow without waiting until 07:00.
| Variable | Required | Description |
|---|---|---|
DISCORD_TOKEN |
Yes | Bot token from Discord Developer Portal |
CLIENT_ID |
Yes | Application ID used to deploy slash commands |
MONGODB_URI |
Yes | MongoDB connection string (Atlas free tier works) |
DEV_GUILD_ID |
No | Deploy commands to a specific server instantly (testing) |
RUN_ON_START |
No | Run the morning job on bot startup (true/false, default false) |
src/
βββ index.js # Entry point: connects DB, loads commands, logs in
βββ config.js # Environment variables and constants
βββ scheduler.js # Cron job at 07:00 + per-event setTimeout reminders
βββ db/
β βββ connection.js # MongoDB connection
β βββ guildRepository.js# CRUD for guild β channel mappings
βββ commands/
β βββ setup.js # /setup command
β βββ remove.js # /remove command
βββ services/
β βββ calendar.js # Fetches and parses Forex Factory XML feed
β βββ notifier.js # Posts embeds to Discord channels
βββ formatters/
β βββ embeds.js # Builds Discord EmbedBuilder objects
βββ utils/
βββ logger.js # Timestamped console logger
scripts/
βββ deploy-commands.js # One-time script to register slash commands
The Procfile is configured for Railway:
- Push to GitHub
- Connect the repo on Railway
- Set environment variables in Railway dashboard
- Railway runs
node src/index.jsautomatically
Run npm run deploy once after first deploy to register slash commands.