Skip to content
forked from mayudev/revcord

A bridge for Discord and Revolt with easy setup through commands

License

Notifications You must be signed in to change notification settings

Lesekater/revcord

 
 

Repository files navigation

revcord

🌉 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

📔 Features

  • Bridge messages between platforms
  • Bridge attachments
  • Bridge replies
  • Bridge message edit and delete
  • Bridge embeds
  • Bridge emoji1
  • Seamlessly display user information

Screenshot - Revolt Screenshot - Discord

🔩 Setup

You can use Docker as well.

Node v16.9+ is required!

Important: this bot is meant to be used in one server (Discord+Revolt), but can be used in more as long as they share the same admin.

  1. Clone this repository, install dependencies and build
git clone https://github.com/mayudev/revcord
cd revcord
npm install
npm run build
  1. Create a bot in Discord (Guide) and Revolt (Open user settings -> My Bots -> Create a bot)
  2. Place the relevant tokens in environment variables. The easiest way is to create a .env file (yes, a file called .env):
DISCORD_TOKEN = ...
REVOLT_TOKEN = ...

Of course, replace ... with tokens.

If you are running a self-hosted instance of Revolt, additionally set the API_URL variable:

API_URL = https://api.revolt.chat
  1. 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 select Administrator) Note applications.commands!

permissions

  1. Enable the Message Content Intent under Bot -> Privileged Gateway Intents. If you forget to do this, the bridge will only work one way (from Revolt to Discord) and messages from Discord will be empty.

intent

  1. Important! On Revolt, make sure to add the bot to a role that has the Masquerade permission!

revolt permissions

  1. Invite the bot to to a Revolt and Discord server.
  2. 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).

Using Docker

You need Docker and docker-compose installed.

Follow the steps above to create a .env file2. You do not have to run npm install and npm run build, obviously. Also, make sure your bots have all the required permissions as explained above.

Before you run docker-compose, use touch revcord.sqlite to create the database file and leave it empty.

Then you should be ready to go.

docker-compose up -d

🔧 Configuration

with commands

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).

Connecting Discord and Revolt channels

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.

Removing the connection

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.

Showing connections

From Discord:

/connections

From Revolt:

rc!connections

Toggling bots

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

with mappings.json (not recommended)

This is not recommended!

  1. Create a mappings.json file in the root directory.
  2. Use the following format:
[
  {
    "discord": "discord_channel_id",
    "revolt": "revolt_channel_id"
  },
  {
    "discord": "another_discord_channel_id",
    "revolt": "another_revolt_channel_id"
  }
]

🔥 Troubleshooting

Messages sent to Discord have no content!

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.

intent

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:

override

Footnotes

  1. Discord to Revolt only

  2. Alternatively, you can edit the docker-compose.yml file appropriately. Make sure to remove ./.env:/app/.env below volumes: so it won't complain when you don't have a .env file.

About

A bridge for Discord and Revolt with easy setup through commands

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • TypeScript 99.3%
  • Dockerfile 0.7%