Skip to content

Discord bot setup

Nick edited this page Feb 12, 2023 · 11 revisions

(based upon https://github.com/reactiflux/discord-irc/wiki/Creating-a-discord-bot-&-getting-a-token)

Create Bot

First, you need to go here and click "New Application".

Application Screen

Now give your bot a name.

Create an Application Screen

Click "Create". On the next screen, you can optionally set an Avatar Icon for your app and description.

New App Screen

Next, click on Bot on the left-hand menu

Bot menu item

hen click "Add Bot"

Add Bot

Click "Yes Do It"

Yes Do It.

On the Bot screen you will generate your token. Click "Reset Token" and "Yes, Do It!" a second time.

Reset Token

Yes, Reset Token

Then you can click "Copy" to put the token it in your clipboard. Keep this for your matterbridge config file.

Token

Here, you can also toggle if the bot is public, which will allow others to invite to their servers. This is off by default and will not do anything unless the matterbridge configuration file lists the servers it has been invited to, so you should just leave this off.

Public Bot

Privileged Gateway Intents

Make sure to also toggle the "Server Members Intent" and "Message Content Intent" options further down under "Privileged Gateway Intents" to allow the bot to see the member list, otherwise you'll get an error message similar to Error obtaining server members: HTTP 403 Forbidden, {"message": "Missing Access", "code": 50001}.

Click "Save Changes"

Server Members Intent

Invite bot

Now it's time to invite your bot to your server. Don't worry about your bot being started for this next step. You can get this under OAuth2 → General Client ID

Copy the client ID into this URL and go to it

https://discordapp.com/oauth2/authorize?&client_id=YOUR_CLIENT_ID_HERE&scope=bot&permissions=536870912

The weird number (536870912 = 0x20000000) corresponds to the "Manage Webhooks" permission. If you don't want to use AutoWebhooks=true, then you can use 0 instead, but you will need to configure the necessary webhooks manually.

It will prompt you to select your server

Add Bot

and then Authorize it

Authorize Bot

Solve CAPTCHA if necessary

2020-10-14-133937_317x178_scrot

Then you should see

Authorized

You can confirm the bot is added by looking in your #general channel for "A wild [bot name] appeared!" or "Welcome [bot name]. We hope you brought pizza." or some other pithy welcome message, and checking under Your Guild > Settings > Integrations > Bots and Apps.

Invite to channels

For each channel you want to bridge, you need to make sure the bot user is a member.

The bot should be in all public channels in your server by default, but for private channels you must either make sure to give it an appropriate Role, or to directly add it under Edit Channel > Permissions > Roles/Members

Edit Channel Permissions

It needs to have View and Send permissions

View Permission

Send Permission

If you have trouble with this, open an issue and we can improve these docs.

Matterbridge Config

Take the bot's token (the token, not the client ID) and add it to your matterbridge config like so:

[discord.yourbridgeid]
Token="NzY1OTgwMjA2Nzc4Mjg2MTIx.Gpz4tE.HOslqKftF2_bm2y_bIaaACyy3_vLBmbevl02JQ"
# ....

Then set up your individual bridges.

Clone this wiki locally