Step 20 of 18
Discord Bridge
Discord Bridge
Optional. Bridge your existing Discord server to Matrix for gradual migration.
This is advanced. You need:
- A running KamenChat server
- An admin account on Matrix
- A Discord bot
Step 1: Create Discord Bot
- Go to discord.com/developers/applications
- Click New Application → Name it (e.g., “KamenChat Bridge”)
- Go to Bot tab → Click Add Bot
- Click Reset Token → Copy the token (save it!)
- Enable Privileged Gateway Intents:
- ✅ PRESENCE INTENT
- ✅ SERVER MEMBERS INTENT
- ✅ MESSAGE CONTENT INTENT
- Save changes
Step 2: Run Bridge Setup
./scripts/setup-discord-bridge.sh
Enter your Discord bot token when prompted.
Step 3: Register the Bridge
- Open your Matrix client
- Go to the Admin room (you auto-joined when you created your account)
- Send this command with the registration file contents in a code block:
!admin appservices register
id: "discord"
url: "http://discord-bridge:9005"
as_token: "your-token-here"
hs_token: "your-token-here"
sender_localpart: "_discord_bot"
rate_limited: false
namespaces:
users:
- exclusive: true
regex: '@_discord_.*'
aliases:
- exclusive: false
regex: '#_discord_.*'
rooms: []
- Confirm it worked:
!admin appservices list
Should show: Appservices (1): discord
Step 4: Start the Bridge
docker compose -f docker-compose.yml -f docker-compose.bridge.yml up -d discord-bridge
Check logs:
docker logs kamenchat-discord-bridge --tail=20
Look for: Discordbot started successfully
Step 5: Invite Bot to Discord
- Go back to discord.com/developers/applications
- Select your bot → OAuth2 → URL Generator
- Select bot scope
- Permissions: Administrator (easiest)
- Copy the generated URL
- Open URL → Select your server → Authorize
Step 6: Bridge a Channel
In Matrix:
- Create or open a room
- Invite the bridge bot:
@_discord_bot:yourdomain.com - Get your Discord server ID and channel ID:
- Enable Developer Mode in Discord (Settings → Advanced)
- Right-click server → Copy ID
- Right-click channel → Copy ID
- In the Matrix room, type:
!discord bridge SERVER_ID CHANNEL_ID
Done! Messages now flow both ways.
Commands
| Command | Description |
|---|---|
!discord bridge <server> <channel> | Bridge this room to a Discord channel |
!discord unbridge | Remove bridge from this room |
Troubleshooting
Bot not connecting? Check token is correct in config/discord-bridge/config.yaml
Messages not bridging? Make sure bot has Administrator permissions in Discord
Bridge crashing? Check logs: docker logs kamenchat-discord-bridge