fork of https://f-hub.org/XMPP/xmpp-discord-bridge
Python 100.0%
50 1 0

Clone this repository

https://tangled.org/zenfyr.dev/xmpp-discord-bridge https://tangled.org/did:plc:rjhjcb3rgdsmdr6ykywuh63z/xmpp-discord-bridge
git@knot.synth.download:zenfyr.dev/xmpp-discord-bridge git@knot.synth.download:did:plc:rjhjcb3rgdsmdr6ykywuh63z/xmpp-discord-bridge

For self-hosted knots, clone URLs may differ based on your setup.

Download tar.gz
README.md

xmpp-discord-bridge#

xmpp-discord-bridge's goal is to be a highly integrated bridge between XMPP and Discord.

Features#

  • Uni-directional bridging of Discord reactions to XMPP: Currently without XEP-0424, but with a "compat" mode
  • Bi-directional bridging of media using Webhook embeds and OOB data
  • Uni-directional bridging of Discord presence to XMPP
  • Puppetering support on the side of XMPP
  • Automatic webhook creation
  • Uni-directional sync of the Discord channel's topic
  • XMPP Avatar spoofing on the Discord side
  • Support for proxying media sent via Discord (With this miniproxy)

Install#


⚠️ This is how I set it up on Debian Bookworm. If you need help adapting it to your distribution, please open an issue or ask for help on Jabber.

⚠️ This guide also does not use a "venv" (virtual environment). I had an issue running it in its own "venv". If someone wants to troubleshoot it, contributions are welcome.


  1. Install needed dependencies.
sudo apt install git python3-full pip cmake
  1. Create a new system user to run it under.
sudo adduser --system --home /var/lib/xmpp-discord-bridge xmpp-discord-bridge  
  1. Now open a shell as that user.
sudo -u xmpp-discord-bridge -s  
  1. Run:
cd && git clone "https://codeberg.org/queer-spark/xmpp-discord-bridge.git" && cd xmpp-discord-bridge && python3 -m pip install . --user --break-system-packages && cd  
  1. Create and edit ~/config.toml. Refer to example.toml for options.

  2. exit to leave the shell.

  3. Copy the service file to systemd's system directory.

sudo cp /var/lib/xmpp-discord-bridge/xmpp-discord-bridge/optional/xmpp-discord-bridge.service /etc/systemd/system/  
  1. Read through the XMPP and Discord sections and make sure the listed requirements are met.

  2. Start and enable the bridge.

sudo systemctl enable --now xmpp-discord-bridge.service  

XMPP#

In order for the bridge to work, it needs to have an affiliation of owner before joining. Going off of the example.toml, it would have the JID of bot@discord.example.com. The virtual users that follow will be automatically added to the room with an affiliation of member.

Discord#

(based upon https://github.com/42wim/matterbridge/wiki/Discord-bot-setup)

Create Bot#

You need to setup a "Bot" on Discord. Go here and click "New Application".

Then give your bot a name. Click "Create". On the next screen, you can optionally set an Avatar Icon for your app and description.

Next, click on "Bot" on the left-hand menu. Then click "Add Bot", then "Yes Do It".

On the "Bot" screen, click "Reset Token" and "Yes. Do It!". Then click "Copy" to copy it. Then paste it to "discord_token" in your config.toml.

Optional: Here, you can also toggle if the bot is public, which will allow others to invite it to their servers.

Make sure to also toggle the "Server Members Intent" and "Message Content Intent" options further down under "Privileged Gateway Intents" to allow the bot to see the member list.

Invite Bot#

Now it's time to invite your bot to your server. Don't worry about your bot being started for this next step. On the left-hand menu click "OAuth2" and copy the Client ID into this URL then navigate to it.

https://discordapp.com/oauth2/authorize?&client_id=YOUR_CLIENT_ID_HERE&scope=bot&permissions=536870912  

The "permissions=536870912" at the end of the URL corresponds to the "Manage Webhooks" permission. It is required for the bridge to work correctly.

Discord will ask you which guild to invite it to. Select the guild then Authorize it.

License#

See ./LICENSE