fork of https://f-hub.org/XMPP/xmpp-discord-bridge
1# xmpp-discord-bridge
2
3Continuation of [this repo](https://codeberg.org/queer-spark/xmpp-discord-bridge).
4
5This project is in very low maintenance mode currently. If you want to try it anyway, docker is most likely to work.
6
7xmpp-discord-bridge's goal is to be a highly integrated bridge between XMPP and Discord.
8
9## Features
10
11- Uni-directional bridging of Discord reactions to XMPP: Currently without XEP-0424, but with a "compat" mode
12- Bi-directional bridging of media using Webhook embeds and OOB data
13- Uni-directional bridging of Discord presence to XMPP
14- Puppetering support on the side of XMPP
15- Automatic webhook creation
16- Uni-directional sync of the Discord channel's topic
17- XMPP Avatar spoofing on the Discord side
18- Support for proxying media sent via Discord (With this [miniproxy](https://git.polynom.me/PapaTutuWawa/miniproxy) ([Mirror](https://codeberg.org/queer-spark/miniproxy)))
19
20## Screenshots
21
22 side of the channel") 
23
24## XEP Requirements
25
26Some users have experienced issues unless their XMPP server supports certain XEPs. This is an incomplete list, only added to when incompatibility is found.
27
28- [XEP-0359](https://xmpp.org/extensions/xep-0359.html)
29
30## Install using pipx
31
32Run below as an user, not as root. You can create a separate system user with `sudo adduser --system` (run `sudo adduser --help` for more information) and run a shell as that user with `sudo -u systemuser -s`, replacing `systemuser` with the user you created.
33
34```shell
35git clone https://codeberg.org/queer-spark/xmpp-discord-bridge.git
36cd xmpp-discord-bridge
37pipx install .
38```
39
40Create and edit `~/config.toml`. Refer to [example.toml](docs/example.toml) for options.
41
42## Build Dockerfile
43
44Navigate to the repository root and run the following command (Note that you can substitute `podman` with `docker`):
45
46```shell
47podman build -t xmpp-discord-bridge:latest -f contrib/Dockerfile .
48```
49
50> **_Note:_** Docker can not communicate on `127.0.0.1`, which XMPP services listen on for external components. You will need to configure your XMPP service to listen on all interfaces with `0.0.0.0`. Here is the documentation needed for [Prosody](https://prosody.im/doc/components#advanced-network-configuration) and [Ejabberd](https://docs.ejabberd.im/admin/configuration/listen-options/#hosts).
51
52### XMPP
53
54In 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`.
55The virtual users that follow will be automatically added to the room with an affiliation
56of `member`.
57
58### Discord
59
60(based upon https://github.com/42wim/matterbridge/wiki/Discord-bot-setup)
61
62#### Create Bot
63
64You need to setup a "Bot" on Discord. Go [here](https://discord.com/developers/applications) and click "New Application".
65
66Then give your bot a name. Click "Create". On the next screen, you can optionally set an Avatar Icon for your app and description.
67
68Next, click on "Bot" on the left-hand menu. Then click "Add Bot", then "Yes Do It".
69
70On 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`.
71
72Optional: Here, you can also toggle if the bot is public, which will allow others to invite it to their servers.
73
74Make 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.
75
76#### Invite Bot
77
78Now 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.
79
80 https://discordapp.com/oauth2/authorize?&client_id=YOUR_CLIENT_ID_HERE&scope=bot&permissions=536870912
81
82The "permissions=536870912" at the end of the URL corresponds to the "Manage Webhooks" permission. It is required for the bridge to work correctly.
83
84Discord will ask you which guild to invite it to. Select the guild then Authorize it.
85
86## Support & Contributing
87
88Pull requests are welcome! There are plenty of issues that still need to be worked on. You are also welcome to open new issues.
89
90## License
91
92See `./LICENSE`