Discord
This page is for a streamer who already has a Discord server. After it, you will know what the Discord bridge does, how to set it up in four steps, what it does not carry, and what needs your own hand on Discord's side.
What the bridge does
A bridge is a program that sits between two chat systems and copies messages both ways. Black Branch comes with one for Discord, Out Of Your Element (OOYE), an open-source Discord bridge for Matrix. It runs on your own server beside your homeserver, and it is off on a new install.
Once it is on and a Discord channel is linked to one of your community rooms:
- Messages go both ways. A message in the Discord channel shows in the room, and a message in the room shows in the Discord channel. Edits, deletions and replies follow.
- People keep their names. Discord people appear in your room under their Discord name and picture, each as an account of the bridge's own (their Matrix ID starts with
@_ooye_). Your members appear on Discord under their own name and picture. - Custom emoji reach the other side, and a reaction made here reaches Discord. A Discord thread becomes a room of its own, beside the linked room.
- Your Discord server can become your community. The import reads your Discord server once and proposes the same shape here: each category a category, each text and announcement channel a channel, and who can see and post in each, worked out from Discord's permissions.
The bridge never decides who is who on your site. Roles, bans and who can join a room stay with your site; see Who can link what.
What you need
- The Discord server, and a Discord account that may manage it (Discord's Manage Server permission), to add the bridge's bot.
- A Discord application of its own for this install. The bridge takes over the application's commands, so it can never share one with another bot, and two installs can never share one either.
- Shell access to your server for one command,
sudo blackbranch discord on.
Setting it up
Everything happens on one page, Admin Panel → Site → Discord (under Community). At its top, Discord bridge: off, on or waiting says where the bridge stands, with the Doctor's own sentence under it. The import waits until Discord lets the bot in, and linking waits until the bridge is on.
1. The bot
The page shows the two steps on Discord's side, with a Copy button for the words to paste:
- A Discord application for this server only. In the Discord Developer Portal, press New Application. Put Powered by OOYE somewhere in its description: the bridge's author asks for it.
- Its intents and its bot token. On the application's Bot page, under Privileged Gateway Intents, switch on Presence Intent, Server Members Intent and Message Content Intent, and save. Then press Reset Token, copy the token, paste it into the page and press Save the token.
The server writes the token into the bridge's own settings file. The site keeps no copy, and the page never shows it again. To change it, paste a new one the same way: only the bridge restarts.
Then switch the bridge on, on the server:
sudo blackbranch discord on
It refuses until a token is saved. It builds the bridge (a minute or two the first time, more on a slow server) and starts it; sudo blackbranch discord off switches it off again. The page's top line turns on once Discord and your homeserver have let the bridge in.
Press Check again. The page now says Discord lets the bot in, with the bot's name and the Discord servers it is in. A warning shows while Server Members or Message Content is still off. Then open Discord's add-the-bot page (a link the bridge builds, with the permissions it needs), pick your Discord server, press Authorize, and press Check again: your server shows among the bot's servers.
2. Import the Discord server
Pick your server from the list (or paste its ID) and press Read the server. Nothing on Discord changes. The page shows what your community would become:
- Channels: each text and announcement channel, in its category, with Who can see and Who can post as sentences. Untick a channel to leave it out, rename it, or change either sentence.
- Needs your choice: a channel where no sentence says exactly what Discord does. The box spells out Discord's permissions, and the page has already picked the sentence that lets in nobody Discord kept out.
- Kept on Discord: forum, voice and stage channels. No bridge carries them.
- Roles: each Discord role, set on your role ladder. A Mod role that may manage channels on Discord asks Mod or Staff?. A Supporter role says where it comes from (Server Boosters, a Twitch or YouTube link on Discord, a Patreon or Ko-fi bot by the role's name).
Press Confirm the import. The categories and channels are made in one go, and your server builds the rooms on its next run (see What your server keeps for you). Reading the server again later shows only what changed: new channels ticked, changes on either side marked Differs and left unticked. Nothing is ever made twice.
You can skip the import and link rooms you made yourself.
3. Link the Discord server
Paste your Discord server's ID and press Link the server. This can take up to a minute the first time, while your server seats the bridge's bot in the community's space. Once linked, the community's name and picture follow the Discord server's, as the bridge sets them; unlink and they are the panel's again.
Unlink the server asks first: it unlinks every room, and the bot leaves the Discord server.
4. Links
Every room in your community is listed. Beside each, paste a Discord channel ID and press Link (a room the import made has its own channel filled in already). A room says Linked, Waiting for the bridge (with Try again), Not made yet or Only rooms everyone can see and post in. Unlink undoes one link. Check again reads again what the bridge holds.
The Doctor has two rows for the bridge, Discord bridge and Discord bot sees the server; see Health and the Doctor. When something is red, sudo blackbranch logs ooye says what Discord or your homeserver answered.
Who can link what
- Only admins see the Discord page. Mods and viewers cannot link or unlink anything.
- Only a room everyone in the community can see and post in can be linked. Discord would otherwise widen a narrower room. For the same reason, a linked room's Who can see and Who can post cannot be narrowed on the Community page: unlink it first.
- One room, one channel. A Discord channel of another Discord server is refused.
- Viewers do not link a Discord account to their site account. A Discord person is a separate account in your rooms, and your site's roles, supporter perks and bans do not follow them from Discord.
- Discord bans are not carried here. A switch to mirror them on your site is not in this release: it needs a Discord account to be linked to a person here first.
What it does not carry
- A thread reply made on your site reaches Discord as a plain reply, not in a Discord thread.
- Stickers from your site reach Discord as a link.
- Files over 5 MB from Discord arrive as links.
- Forum, voice and stage channels stay on Discord.
- Discord roles are read at the import. A role changed on Discord later changes nothing here until you import again.
These are also listed at the bottom of the Discord page.
What needs your hand on Discord's side
- Making the application, switching on its three intents, and pasting its token. Above 10,000 people in a Discord server, Discord asks for a yearly review before a bot may keep these intents.
- Adding the bot to your Discord server with the add-the-bot link.
- Keeping the bot in the server. If someone removes it, the Discord bot sees the server row turns red; add it again with the same link.
Known gaps, such as the bridge's database not yet being in the backups, are on Known gaps.
Next: 7TV emotes