Just because the docs on https://github.com/42wim/matterbridge/wiki/ are a little bit obscure in some parts, here's a complete record of what I did:
sudo pacman -S matterbridge
- Set up a generic systemd service file:
$ cat /etc/systemd/system/matterbridge\@.service
[Unit]
Description=%I Chat Bridge
After=network-online.target
[Service]
Type=simple
ExecStart=/usr/bin/matterbridge -conf /etc/matterbridge/%I.toml
Restart=always
RestartSec=5s
User=matterbridge
[Install]
WantedBy=multi-user.target
-
Went to prosody, ran
sudo prosodyctl adduser [email protected]
; generate the password with a password generator -
Went to https://discord.com/developers/applications, followed https://github.com/42wim/matterbridge/wiki/Discord-bot-setup; ran into bugs, documented them at 42wim/matterbridge#1944
Eventually ended up with the bot joined and. MAKE SURE NOT TO SET ANY PERMISSIONS, the only permission you need is the "Create Webhook" permission, which is embedded in the URL that wiki page tells you to use to trigger the OAuth Authorize step
-
Wrote this matterbridge config:
$ cat /etc/matterbridge/lab.toml
[xmpp]
[xmpp.bridge]
Server="chat.example.com:5222"
Jid="[email protected]"
Password="xxxxxxxxxxxxxxx"
Muc="conference.example.com"
Nick="Discord"
RemoteNickFormat="<{NICK}> "
[discord]
[discord.bridge]
Token="xxxxxxxxxxxxxxxxxxxxxxx"
Server="7xxxxxxxxxxxxxxxxx" # get this from your discord url; if you're in https://discord.com/channels/7xxxxxxxxxxxxxxxxx/9xxxxxxxxxxxxxxxxx, take the first part
AutoWebhooks=true
RemoteNickFormat="{NICK}"
# ----------------------
[[gateway]]
name="general"
enable=true
[[gateway.inout]]
account="discord.bridge"
channel="ID:9xxxxxxxxxxxxxxxxx" # ditto, if in https://discord.com/channels/7xxxxxxxxxxxxxxxxx/9xxxxxxxxxxxxxxxxx, take the last part
[[gateway.inout]]
account="xmpp.bridge"
channel="general%lab" # -> this becomes general%[email protected]
[[gateway]]
name="cowork"
enable=true
[[gateway.inout]]
account="discord.bridge"
channel="ID:9xxxxxxxxxxxxxxxx"
[[gateway.inout]]
account="xmpp.bridge"
channel="cowork%lab" # ditto
sudo systemctl enable --now matterbridge@lab
Bridges for other communities can be added by creating other bots/bot users and writing their credentials into other config files under /etc/matterbridge, They could all be run in a single matterbridge conf file, but that's more fragile. This way different communities can tick along mostly independently, so long as the underlying server is up.
- Watch logs with
journalctl -f -u matterbridge@lab