No description
This repository has been archived on 2024-01-24. You can view files and clone it, but cannot push or open issues or pull requests.
Find a file
2020-12-01 17:09:41 +00:00
config Set bridge.port to 9005 in the sample config 2020-12-01 10:45:51 +01:00
docs Merge branch 'develop' into hs/move-to-bot-sdk 2020-01-25 20:09:26 +00:00
src Fix port bug 2020-12-01 11:12:50 +00:00
test Appease the tests 2020-11-06 14:55:16 -07:00
tools Fix tooling too 2020-11-06 14:17:51 -07:00
.dockerignore Remove tools from dockerignore 2018-07-28 12:19:01 -05:00
.gitignore add why-is-node-running 2018-11-07 14:55:43 +01:00
.mocharc.yml Update mocha to use config file 2020-06-18 11:23:15 +01:00
.nycrc Add .nycrc 2019-05-16 16:59:24 +01:00
.travis.yml Move to Node 12,14 2020-11-06 17:03:24 +00:00
CONTRIBUTING.md More fixes to contrib.md 2019-05-12 17:31:35 +01:00
Dockerfile Bump Dockerfile NodeJS version to 14 2020-11-06 17:13:47 +00:00
LICENSE Initial commit 2016-06-19 00:09:33 +01:00
package-lock.json Merge branch 'release/1.0.0' 2020-12-01 17:09:41 +00:00
package.json 1.0.0 2020-12-01 11:17:29 +00:00
README.md Merge branch 'release/1.0.0' 2020-12-01 17:09:41 +00:00
screenshot.png Update screenshot 2018-11-06 15:26:28 +00:00
tsconfig.json Tweak CI 2020-11-03 10:00:54 +00:00
tslint.json Linting 2019-08-20 20:16:34 +01:00
yarn.lock Typo 2020-11-06 17:05:39 +00:00

Matrix Discord Bridge

A bridge between Matrix and Discord. Currently the bridge is in Beta and quite usable for everyday bridging, with one or two bugs cropping up.

Screenshot of Riot and Discord working together

Helping out

Build Status Docker Automated build #discord:half-shot.uk

PRs

PRs are graciously accepted, so please come talk to us in #discord-bridge:matrix.org about any neat ideas you might have. If you are going to make a change, please merge it with the develop branch :).

Issues

You can also file bug reports/ feature requests on Github Issues which also helps a ton. Please remember to include logs. Please also be aware that this is an unoffical project worked on in our spare time.

Setting up

The bridge has been tested against the Synapse homeserver, although any homeserver that implements the AS API should work with this bridge.

The bridge supports any version of Node.js >= v12.X, including all current releases.

Setup the bridge

  • Run npm install to grab the dependencies. npm may complain about peer dependencies, but you can safely ignore these.

  • Run npm run build to build the typescript into javascript.

  • Copy config/config.sample.yaml to config.yaml (move to root app folder) and edit it to reflect your setup.

    • Note that you are expected to set domain and homeserverURL to your public host name. While localhost would work, it does not resolve correctly with Webhooks/Avatars. Please note that a self-signed SSL certificate won't work, either.
    bridge:
        domain: "example.com"
        homeserverUrl: "https://example.com"
    
  • Run node build/src/discordas.js -r -u "http://localhost:9005" -c config.yaml

  • Modify your HSs appservices config so that it includes the generated file.

    • e.g. On synapse, adding to app_service_config_files array in homeserver.yaml
    app_service_config_files:
      - "discord-registration.yaml"
    
    • Copy discord-registration.yaml to your Synapse's directory.

Docker

Following the instructions above, generate a registration file. The file may also be hand-crafted if you're familiar with the layout. You'll need this file to use the Docker image.

# Create the volume where we'll keep the bridge's files
mkdir -p /matrix-appservice-discord

# Create the configuration file. Use the sample configuration file as a template.
# Be sure to set the database paths to something like this:
#  database:
#    filename: "/data/discord.db"
#    userStorePath: "/data/user-store.db"
#    roomStorePath: "/data/room-store.db"
nano /matrix-appservice-discord/config.yaml

# Copy the registration file to the volume
cp discord-registration.yaml /matrix-appservice-discord/discord-registration.yaml

# Optional: Build the container yourself (requires a git clone, and to be in the root of the project)
docker build -t halfshot/matrix-appservice-discord .

# Run the container
docker run -v /matrix-appservice-discord:/data -p 9005:9005 halfshot/matrix-appservice-discord

Metrics

The bridge supports reporting metrics via Prometheus. You can configure metrics support in the config file. The metrics will be reported under the URL provided in the registration file, on the /metrics endpoint.

3PID Protocol Support

This bridge support searching for rooms within networks via the 3pid system used in clients like Riot. Any new servers/guilds you bridge should show up in the network list on Riot and other clients.

Setting up Discord

  • Create a new application via https://discordapp.com/developers/applications
  • Make sure to create a bot user. Fill in config.yaml
  • Run npm run addbot to get a authorisation link.
  • Give this link to owners of the guilds you plan to bridge.
  • Finally, you can join a room with #_discord_guildid_channelid
    • These can be taken from the url ("/$GUILDID/$CHANNELID") when you are in a channel.
    • Riot (and other clients with third party protocol support) users can directly join channels from the room directory.
  • You can use Webhooks to make messages relayed by the bridge not nested by the bot user. This will also display the avatar of the user speaking on matrix with their messages.
    • The bot should create this automatically, but if not perform the following:
      • Enable Manage Webhooks on the role added by the bot.
      • Add the _matrix Webhook for each channel you'd like to enable this feature on.

Running the Bridge

  • For the bot to appear online on Discord you need to run the bridge itself.
  • npm start
  • Particular configuration keys can be overridden by defining corresponding environment variables. For instance, auth.botToken can be set with APPSERVICE_DISCORD_AUTH_BOT_TOKEN.

Howto

Features and Roadmap

In a vague order of what is coming up next

  • Matrix -> Discord
    • Text content
    • Image content
    • Audio/Video content
    • Typing notifs (Not supported, requires syncing)
    • User Profiles
  • Discord -> Matrix
    • Text content
    • Image content
    • Audio/Video content
    • Typing notifs
    • User Profiles
    • Presence
    • Per-guild display names.
  • Group messages
  • Third Party Lookup
    • Rooms
    • Users
  • Puppet a user's real Discord account.
    • Sending messages
    • Direct messages
    • UI for setup
  • Rooms react to Discord updates
  • Integrate Discord into existing rooms
    • Feature
    • UI
  • Manage channel from Matrix (possibly)
    • Authorise admin rights from Discord to Matrix users
    • Topic
    • Room Name
  • Provisioning API
  • Webhooks (allows for prettier messages to discord)
  • VOIP (Hard | Unlikely to be finished anytime soon)

Contact

My Matrix ID: @Half-Shot:half-shot.uk