π A cord to connect your Revolt and Discord servers
π A bridge for Discord and Revolt with easy setup through commands, written in TypeScript using revolt.js.
Features | Setup | Configuration | Troubleshooting
- Bridge messages between platforms
- Bridge categories automatically
- Creating categories
- Moving channels to categories
- Bridge channels automatically 1
- Automatically create channel (Discord <-> Revolt)
- Automatically update channel (Discord <-> Revolt) 2
- Automatically disconnect channel on delete (Discord <-> Revolt)
- Bridge roles automatically (acts as a label only, permissions aren't synced!)
- Create role
- Update role
- Delete role
- Assign role
- Unassign role
- Bridge attachments
- Automatically reupload attachments to Revolt
- Bridge replies
- Bridge message edit and delete
- Bridge embeds
- Include attachments
- Bridge emoji 3
- Automatically import emoji
- Mapping Discord emoji to Revolt variants
- Seamlessly display user information
- Initial import of channels & roles
Important
While this bot should in theory work for multiple servers at a time, it has only been tested with 1 server (Discord + Revolt). If there are any compatibility issues, please let us know.
-
Create a bot in Discord (Guide)
-
Important! Make sure to select the following permissions in URL Generator when making an invite for your bot (Your bot in Discord Developers ->
OAuth2->URL Generator) (or if you're lazy, just selectAdministrator) Note applications.commands!
- Enable the
Message Content Intentunder Bot -> Privileged Gateway Intents. If you forget to do this, the bot will crash with aUsed disallowed intentsmessage.
- Create a bot in Revolt (Open user settings ->
My Bots->Create a bot) - Important! make sure to add the bot to a role that has the Masquerade permission!
To help you get started creating a container from this image you can either use docker-compose or the docker cli.
services:
revcord:
image: ghcr.io/meme-bros/revcord:latest
volumes:
- /path/to/revcord.sqlite:/app/revcord.sqlite:rw
environment:
- DISCORD_TOKEN="INSERT_DISCORD_TOKEN_HERE"
- REVOLT_TOKEN="INSERT_DISCORD_TOKEN_HERE"
restart: unless-stopped
then run with docker compose up -d
docker run -d \
--name revcord \
-v "/path/to/revcord.sqlite:/app/revcord.sqlite:rw" \
-e DISCORD_TOKEN="INSERT_DISCORD_TOKEN_HERE" \
-e REVOLT_TOKEN="INSERT_DISCORD_TOKEN_HERE" \
--restart unless-stopped \
ghcr.io/meme-bros/revcord:latest
| Environment Variables | Description | Required |
|---|---|---|
DISCORD_TOKEN |
Discord bot token | β |
REVOLT_TOKEN |
Revolt bot token | β |
API_URL |
Revolt API URL for custom self-hosted instances | β |
REVOLT_ATTACHMENT_URL |
Revolt attachment URL for custom self-hosted instances | β |
Note
If you use docker you can skip to Configuration
Important
Node v16.9+ is required!
- Clone this repository, install dependencies and build
git clone https://github.com/Meme-Bros/revcord.git
cd revcord
npm install
npm run build- Place the relevant tokens in environment variables. The easiest way is to copy .env.example file and fill in the following information
DISCORD_TOKEN = ...
REVOLT_TOKEN = ...
Of course, replace ... with tokens.
If you are running a self-hosted instance of Revolt, additionally set the API_URL and REVOLT_ATTACHMENT_URL variable to your own host:
API_URL = https://example.com/api
REVOLT_ATTACHMENT_URL = https://example.com/autumn
- Start the bot using
npm start
Note
it's recommended to use something like pm2 or nodemon to run the bot. Make sure to pass the --experimental-specifier-resolution=node flag to node manually, otherwise it will not run (it's included in the default start script).
You can use either slash commands on Discord or rc! prefix on Revolt (use rc!help to show all commands)
To use the commands, you need the Administrator permission on Discord. On Revolt, only the server owner can run them (for now).
From Discord:
/connect <Revolt channel name or ID>
From Revolt:
rc!connect <Discord channel name or ID>
For example:
# From Discord
/connect lounge
/connect 01AB23BC34CD56DE78ZX90WWDB
# From Revolt
rc!connect general
rc!connect 591234567890123456
βοΈ Send a message to see if it works. Try editing and deleting it.
From Discord:
/disconnect
From Revolt:
rc!disconnect
You don't have to specify any channel. It will disconnect the channel the command is sent in.
From Discord:
/connections
From Revolt:
rc!connections
You can toggle whether messages sent by bots should be forwarded. It's enabled by default (it's requied for NQN to work properly).
Use either rc!bots or /bots
npm install takes way too long, or Please install sqlite3 package manually (Raspberry Pi / 32-bit arm devices)
This is an issue with node-sqlite3 being a native module, but has no prebuilt binaries for 32-bit arm architectures available, therefore falling back to building from source.
However, a Raspberry Pi is usually too low powered to finish compiling it.
So, the only solution would be to use a more powerful device to cross-compile it to arm. For convenience, a prebuilt binary for armv7l architecture was provided here
You have to place it in node_modules/sqlite3/lib/binding/napi-v6-linux-glibc-arm/node_sqlite3.node.
Alternatively, if your device supports it (Raspberry Pi 3 does), you can install a 64-bit distribution.
As in setup step 5, you need to enable the Message Content Intent in Discord bot settings. If this doesn't work, make sure the bot has permissions to read the messages in a channel.
Bot doesn't have sufficient permissions in the channel. Please check if the Manage Webhooks permission isn't being overridden for the bot role in that specific channel.
Aside from server-wide permissions, there are also channel-specific permissions. This message means that at some point, the bot's permission to manage webhooks is being overridden on the channel level. The easiest fix is to change the override to allow it. Alternatively, you can grant the bot the Administrator permission which overrides all channel-specific permissions.
In channel settings -> Permissions:
Footnotes
-
For this to function, you need to connect at least 1 channel manually. This is to create the initial link between the Discord Guild and Revolt Server. After this it will automatically create, update and disconnect channels at their corresponding events. β©
-
There is a cool-down timer on this to prevent bridged update loops, so very quick edits back-to-back might not be bridged. If your change was done too quickly and not synced, wait for a little while and then try to update it again, it should then sync everything properly. β©
-
Revolt to Discord works, but limited to 3 emojis displayed to stop bombing with links. Animated emojis from Revolt will convert to static due to limits on Revolt's image backend β©