A Discord bot that synchronizes messages between two channels, preserving the original sender's username and avatar using webhooks.
- Real-time message synchronization between two Discord channels
- Preserves original sender's username and avatar
- Supports text messages, embeds, and file attachments
- Displays server nicknames when available
- Docker support for easy deployment
- Node.js 20+ (for local development)
- Discord Bot Token
- Two Discord channels with webhook access
- Docker (optional, for containerized deployment)
- Go to Discord Developer Portal
- Create a new application
- Navigate to the "Bot" section
- Create a bot and copy the token
- Enable the following bot intents:
- Message Content Intent
- Server Members Intent (if using nicknames)
- In each channel you want to sync:
- Go to Channel Settings → Integrations → Webhooks
- Create a new webhook
- Copy the webhook URL
- Copy
.env.exampleto.env - Fill in the required values:
BOT_TOKEN=your_bot_token_here CHANNEL_1_ID=first_channel_id CHANNEL_2_ID=second_channel_id WEBHOOK_1_URL=webhook_url_for_channel_1 WEBHOOK_2_URL=webhook_url_for_channel_2
- In Discord Developer Portal, go to OAuth2 → URL Generator
- Select scopes:
bot - Select permissions:
View Channels,Read Message History - Use the generated URL to invite the bot to your server
# Install dependencies
npm install
# Build TypeScript
npm run build
# Start the bot
npm start
# Or run in development mode
npm run dev# Build and start the container
docker compose up -d
# View logs
docker compose logs -f
# Stop the container
docker compose down- The bot monitors messages in both configured channels
- When a message is sent in Channel 1, it's forwarded to Channel 2 via Webhook 2
- When a message is sent in Channel 2, it's forwarded to Channel 1 via Webhook 1
- Webhooks preserve the original sender's username and avatar
- Messages from bots are ignored to prevent loops
- Bot not responding: Check that the bot token is correct and the bot is online
- Messages not syncing: Verify channel IDs and webhook URLs are correct
- Permission errors: Ensure the bot has access to both channels
- Webhook errors: Check that webhooks are active and URLs are valid
MIT