| 1 | (based upon https://github.com/reactiflux/discord-irc/wiki/Creating-a-discord-bot-&-getting-a-token) |
| 2 | |
| 3 | ## Create Bot |
| 4 | |
| 5 | First, you need to go [here](https://discord.com/developers/applications) and click "New Application". |
| 6 | |
| 7 |  |
| 8 | |
| 9 | Now give your bot a name. |
| 10 | |
| 11 |  |
| 12 | |
| 13 | Click "Create". On the next screen, you can optionally set an Avatar Icon for your app and description. |
| 14 | |
| 15 |  |
| 16 | |
| 17 | Next, click on Bot on the left-hand menu |
| 18 | |
| 19 |  |
| 20 | |
| 21 | Then click "Add Bot" |
| 22 | |
| 23 |  |
| 24 | |
| 25 | Click "Yes Do It" |
| 26 | |
| 27 |  |
| 28 | |
| 29 | On the Bot screen you will generate your **token**. Click "Reset Token" and "Yes, Do It!" a second time. |
| 30 | |
| 31 |  |
| 32 | |
| 33 |  |
| 34 | |
| 35 | Then you can click "Copy" to put the token in to your clipboard. Keep this for your matterbridge config file. |
| 36 | |
| 37 |  |
| 38 | |
| 39 | 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. |
| 40 | |
| 41 |  |
| 42 | |
| 43 | |
| 44 | ### Privileged Gateway Intents |
| 45 | |
| 46 | 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}`. |
| 47 | |
| 48 | Click "Save Changes" |
| 49 | |
| 50 |  |
| 51 | |
| 52 | ## Invite bot |
| 53 | |
| 54 | 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 |
| 55 |  |
| 56 | |
| 57 | Copy the client ID into this URL and go to it |
| 58 | |
| 59 | ```https://discordapp.com/oauth2/authorize?&client_id=YOUR_CLIENT_ID_HERE&scope=bot&permissions=536870912``` |
| 60 | |
| 61 | 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. |
| 62 | |
| 63 | It will prompt you to select your server |
| 64 | |
| 65 |  |
| 66 | |
| 67 | and then Authorize it |
| 68 | |
| 69 |  |
| 70 | |
| 71 | Solve CAPTCHA if necessary |
| 72 | |
| 73 |  |
| 74 | |
| 75 | Then you should see |
| 76 | |
| 77 |  |
| 78 | |
| 79 | 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. |
| 80 | |
| 81 | |
| 82 | ## Invite to channels |
| 83 | |
| 84 | For each channel you want to bridge, you need to make sure the bot user is a member. |
| 85 | |
| 86 | 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 |
| 87 | |
| 88 |  |
| 89 |  |
| 90 | |
| 91 | It needs to have View and Send permissions |
| 92 | |
| 93 |  |
| 94 | |
| 95 |  |
| 96 | |
| 97 | |
| 98 | If you have trouble with this, open an issue and we can improve these docs. |
| 99 | |
| 100 | |
| 101 | ## Matterbridge Config |
| 102 | |
| 103 | Take the bot's token (the _token_, not the client ID) and add it to your matterbridge config like so: |
| 104 | |
| 105 | ``` |
| 106 | [discord.yourbridgeid] |
| 107 | Token="MY_SECRET_TOKEN" |
| 108 | # .... |
| 109 | ``` |
| 110 | |
| 111 | Then [[set up your individual bridges|Section-Discord-(basic)]]. |
| 112 | |