wiki:en/NLPMatrixDiscord

Version 5 (modified by Ales Horak, 4 days ago) (diff)

--

Redirect Discord messages to NLP Matrix

Redirecting selected rooms or servers from Discord to a NLP Matrix space is easy. You only need to have a user account on both the Discord and NLP Matrix servers and you are ready to go.

The Discord -> Matrix setup consists of the following steps:

  1. Find the Discord tokens and IDs
  2. Create a NLP Matrix discordbot room
  3. Choose which Discord items should be mirrored

Find the Discord tokens and IDs

Connect to the Discord app at https://discord.com/channels/@me and find out the user token and the room and the Discord server (guild) IDs.

Discord user token

Since the Matrix discordbot must operate on Discord on your behalf, you need to provide it with the corresponding Authorization token. The steps to find the token are as follows.

  1. Press <F12> to open the Browser developer tools. Go to the Network tab and filter the URL list for api. Reload the web page.
  2. Choose one of the URLs in the list with type xml or xhr. Display the Request headers.
  3. Find Authorization in the header list - its value is the user token. It should be something like HEWkw2HE329cdsIOAAKSLFoosd.cspdfpoutwBJDW304DAQWEu0sdyvbsasDV02dfsggd3Ie.

Discord server/guild and room IDs

Navigate to a selected Discord room within your https://discord.com/channels/@me app. Look at the URL of the room. It should look like

https://discord.com/channels/3254238502750491529/1650295748356024125

The two numbers, 3254238502750491529 and 1650295748356024125 are the server ID (also called guild ID) and the channel ID.

Create a NLP Matrix discordbot room

Login to NLP Matrix and create a new room named e.g. Discord bridge bot. Invite user @discordbot:nlp.fi.muni.cz to the room. You should see the message

Hello, I'm a Discord bridge bot.
This room has been registered as your bridge management/status room.
Use help for help or login to log in.

In this room, you will be commanding your Discord bridging bot. You may start with the help command.

Choose which Discord items should be mirrored

First, you need to log discordbot to Discord on your behalf. Recall the user token that you have found in the preceding section and in the NLP Matrix Discord bridge bot room enter the command:

login-token user HEWkw2HE329cdsIOAAKSLFoosd.cspdfpoutwBJDW304DAQWEu0sdyvbsasDV02dfsggd3Ie

where the HEWk...Ie is your Authorization user token.

The discord bot should reply with

Connecting to Discord as user ID 4029354238562374375
Successfully logged in as @your.discord.user.name

When logged in, you may connect as many Discord servers as you wish. You don't even need to look for the server/guild ID at Discord. Just ask discordbot for a

guilds status

and it will answer with your list of Discord servers such as

List of guilds:

    FI MUNI (252345435334213123) - never bridge messages
    DigiLing (5562352412313131231) - never bridge messages
    ...

Now instruct discordbot to establish the bridge to FI MUNI as

guilds bridge 252345435334213123 --entire

which shoud lead to the message

Successfully bridged guild

and discordbot creating a number of new invites for you to NLP Matrix space named Discord and to a new NLP Matrix room for each Discord room in the bridged Discord server.


That's it! Now you can manage Discord and Matrix rooms in one place!

Attachments (1)

Download all attachments as: .zip