Add Discord Bridge setup guide and update .gitignore

This commit is contained in:
Roger Gonzalez 2024-11-27 17:40:49 -03:00
parent 572e276db9
commit 13e1bd6718
Signed by: rogs
GPG Key ID: C7ECE9C6C36EC2E6
2 changed files with 134 additions and 1 deletions
.gitignore
config/mautrix-discord

3
.gitignore vendored

@ -11,3 +11,6 @@ config/mautrix-whatsapp/*.yaml
# Mautrix-Telegram config
config/mautrix-telegram/*.yaml
# Mautrix-Discord config
config/mautrix-discord/*.yaml

@ -1 +1,131 @@
# TODO
# Discord Bridge Setup Guide
This guide will help you set up the Discord bridge for your Dendrite Matrix server.
## Prerequisites
Before starting, ensure that:
- Dendrite is properly configured and running.
- The `discord` database was created during the initial setup.
- You have your domain name ready.
## Setup Steps
1. Navigate to the Discord configuration directory:
```sh
cd config/mautrix-discord
```
2. Generate the initial configuration file:
```sh
docker run --rm -v `pwd`:/data:z dock.mau.dev/mautrix/discord
```
3. Edit the generated `config.yaml` file. You may need administrative privileges (sudo) to edit this file.
### Required Configuration Changes
Make the following modifications to your `config.yaml`:
#### Homeserver Settings
```yaml
homeserver:
address: http://monolith:8008 # Internal Docker network address
domain: your.domain.com # Replace with your actual domain
```
#### Appservice Settings
```yaml
appservice:
address: http://discord:29334 # Internal bridge address
hostname: 0.0.0.0 # Listen on all interfaces
```
#### Bridge Settings
```yaml
bridge:
permissions:
"*": relay
"your.domain.com": user # Replace with your domain
"@yourusername:your.domain.com": admin # Replace with your Matrix ID
```
#### Database Connection
Update the database URI to use the Discord-specific database:
```yaml
# Original:
# postgres://dendrite:password@postgres/dendrite?sslmode=disable
# Modified (note 'discord' database name):
postgres://dendrite:password@postgres/discord?sslmode=disable
```
4. Generate the registration file:
```sh
docker run --rm -v `pwd`:/data:z dock.mau.dev/mautrix/discord
```
5. Configure Dendrite to use the Discord bridge by editing `config/dendrite/dendrite.yaml`:
```yaml
app_service_api:
config_files:
- "/etc/discord/registration.yaml"
```
## Starting the Bridge
1. Start the Discord bridge service:
```sh
docker compose up -d mautrix-discord
```
2. Restart Dendrite to load the new bridge configuration:
```sh
docker compose restart monolith
```
## Verifying the Setup
1. Check if the bridge is running:
```sh
docker compose logs mautrix-discord
```
2. Verify the bot is online in Discord
## Using the Bridge
1. Start a chat with `@discordbot:your.domain.com` in your Matrix client
2. Use the OAuth URL you generated earlier to add the bot to your Discord server
3. Use the following commands to start bridging:
- `!discord login` - Link your Discord account
- `!discord bridge <channel>` - Bridge a Discord channel
- `!discord list` - List available servers and channels
## Troubleshooting
Common issues and solutions:
1. **Bridge Not Connecting**
- Verify bot token is correct
- Check if all required intents are enabled
- Ensure bot has proper permissions in Discord
2. **Channel Bridging Issues**
- Verify bot has access to the channel
- Check if the channel type is supported
- Ensure proper permissions in both Discord and Matrix
3. **Message Delivery Problems**
- Check bridge logs for errors
- Verify Discord connection status
- Ensure proper permissions in both platforms