Skip to content

Discord bot setup

Qais Patankar edited this page Jan 8, 2023 · 11 revisions

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

New application

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 set an Avatar Icon for your app and description (not necessary). This is also where you will find your Client ID, more on that later. New App Screen

Next, click on Bot on the left-hand menu, then click "Add Bot" Add Bot

Click "Yes Do It"

Yes Do It.

On the Bot screen you will get to see your token, you can click "Copy" to put it in your clipboard or "Click to reveal your Token", put this in your config file. Here, you can toggle if the bot is public (which will allow others to invite to their servers, this is on by default). Bot Screen 1

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

Change the client_id to your Client ID under App Details, then go to this URL

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.

Now select your server, then click authorize.

Authorize Bot

Solve CAPTCHA if necessary

2020-10-14-133937_317x178_scrot

Then you should see

Authorized

You can confirm the bot is added under Your Guild > Settings > Integrations > Bots and Apps, and in your #general channel you should see "A wild [bot name] appeared!".

Take token

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

[discord.yourbridgename]
Token="NzY1OTgwMjA2Nzc4Mjg2MTIx.X4csqA.HO0F0tg7rvnVrv70kMhQcdXikjY"

# Server (REQUIRED) is the ID or name of the guild to connect to, selected from the guilds the bot has been invited to
Server="70489999999999999999"

That's it! Now you can start your bot and enjoy chatting!

Clone this wiki locally