19 How to create your config
StrajnarFilip edited this page 2022-08-26 20:50:07 +02:00
This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

Step 1

Create an empty matterbridge.toml file.

Step 2

Choose the protocols you want to bridge below, and copy paste those into your config file.
You can select as many different protocols as youd like.
In the example we only use 2 protocols.

In the example below we want messages from channel #general on discord to be sent to channel 42wim/mygreatproject on gitter.
(and messages from channel 42wim/mygreatproject on gitter to channel #general on discord

Just add below to the config

[discord.mydiscord]
#You can get your token by following the instructions on
#https://github.com/42wim/matterbridge/wiki/Discord-bot-setup
#If you want roles/groups mentions to be shown with names instead of ID, 
#you'll need to give your bot the "Manage Roles" permission.
Token="Yourtokenhere"
Server="yourservername"
RemoteNickFormat="[{PROTOCOL}] <{NICK}> "

[gitter.mygitter]
#You can get your token by going to https://developer.gitter.im/docs/welcome and SIGN IN
Token="Yourtokenhere"
RemoteNickFormat="[{PROTOCOL}] <{NICK}> "

Step 3

Change the Token and Server keys above to actual working ones

Step 4

Add the gateway configuration to your config file.
Copy paste the config from Gateway-config-(basic)

Step 5

Modify the gateway config matching the protocols you selected above.
For the correct channel=mychannel settings, look at Gateway-config-(channel-rules)
And save your matterbridge.toml file

# this must always be [[gateway]], don't use anything else
[[gateway]]
name="gateway1"
enable=true

[[gateway.inout]]
account="discord.mydiscord"
channel="ID:0118999881999"

[[gateway.inout]]
account="gitter.mygitter"
channel="42wim/mygreatproject"

The .inout key will forward messages in both directions. You can use .in and .out to forward in one direction e.g. from (in) discord to (out) gitter.

Step 6

Full configuration looks now like this:

[discord.mydiscord]
Token="MTk4NjIyNDgzNDcdOTI1MjQ4.Cl2FMZ.ZnCjm1XVW7vRze4b7Cq4se7kKWs-abD"
Server="myserver"
RemoteNickFormat="[{PROTOCOL}] <{NICK}> "

[gitter.mygitter]
Token="319fda1761c6875739a489b6772daf2ace4b95d0"
RemoteNickFormat="[{PROTOCOL}] <{NICK}> "

[[gateway]]
name="gateway1"
enable=true

[[gateway.inout]]
account="discord.mydiscord"
channel="general"

[[gateway.inout]]
account="gitter.mygitter"
channel="42wim/mygreatproject"

Step 7

Run matterbridge

./matterbridge -conf matterbridge.toml

Step 8 optional

Look at more advanced Settings that you can add to your bridges.

Note: An additional guide is available at https://minecraftchest1.wordpress.com/2021/06/05/how-to-install-and-setup-matterbridge/