Bridging to Matrix

Jump to navigationJump to search

AAGRINDER in-game chat can be bridged to Matrix!

There are two types of bridge: bot and appservice. If you don't have your own Matrix server, you should choose the bot bridge. But if you host your own server or personally know your administrator, you can use the appservice for a better experience. The difference is that the appservice will create a Matrix user for every AAGRINDER player, while the bot sends all messages from the same Matrix account.

What is bridged?[edit]

All Matrix messages are bridged to AAGRINDER unless they originate from the bridge itself. For non-text events, a fallback text representation is displayed.

AAGRINDER messages are bridged to Matrix unless the message begins with "P " (P and a space). Whispers and commands are not bridged. Server console messages are not bridged.

If you are using the appservice, profile pictures will be generated to match the in-game color of players!

Setting up Matrix bot bridge[edit]

By this bridging method, your bridge bot will be a regular Matrix account. Create a Matrix account and get the access_token. Manually join the Matrix room where you want bridged chat and get the ID of this Matrix room.

In order to use the bridge, you need to install the optional dependency matrix-bot-sdk using the following command:

$ npm install matrix-bot-sdk

Example configuration in config.json:

    "matrix_room_id": "!exampleroomid:homeserver.domain",
    "matrix_homeserver_url": "https://homeserver.domain",
    "matrix_bot_enabled": true,
    "matrix_bot_access_token": "tokentokentokentokentokentokentokentokentoken",

Your bridge bot is now ready! It will run as part of the AAGRINDER server.

Setting up Matrix appservice bridge[edit]

By this method, your bridge will integrate into your Matrix server. You need your own Matrix server in order to be able to do this.

First, install the fillowing optional dependencies: matrix-bot-sdk and sharp. sharp is used to generate profile pictures for Matrix accounts.

$ npm install matrix-bot-sdk sharp

Example configuration in config.json:

    "matrix_room_id": "!exampleroomid:homeserver.domain",
    "matrix_homeserver_url": "https://homeserver.domain",
    "matrix_appservice_enabled": true,
    "matrix_appservice_id": "aagrinder",
    "matrix_appservice_url": "http://localhost:8433",
    "matrix_appservice_domain": "homeserver.domain",
    "matrix_appservice_bindaddress": "localhost",
    "matrix_appservice_port": "8433"

If you're bridging multiple AAGRINDER instances to the same Matrix homeserver, you'll need to change the appservice id and the port.

Once you have the configuration, run the following command to generate your registration file mx-aagrinder-registration.yaml:

npm run registration

Add the path to the registration file to app_service_config_files in /etc/matrix-synapse/homeserver.yaml (make sure Synapse is able to read the file). Then restart Synapse.

Your bridge appservice is now ready! It will run as part of the AAGRINDER server.