finish that

This commit is contained in:
2023-09-22 20:27:18 +02:00
parent dba7c42055
commit f56a99dd70

View File

@@ -51,9 +51,43 @@ Click on "New Application" in the top right.
Then, fill in your application's name:
![](https://img.srizan.dev/brave_QYp7LQe5xd.png)
Click on "Bot" in the sidebar, then the "Reset Token" button and copy the token.
Click on "Bot" in the sidebar, then the "Reset Token" button and copy the token. The token should look something like this:
```
MTE1MjM2MDczNzczMDE5OTU2Mg.GUWUsy.dXAoO6NI1Cy3OV7IA-BTGcyzLS28-9tECNcVOg
```
:::danger
Please don't share your discord token (and probably all your other secrets)! Please `gitignore` your `.env` file and keep it safe.
:::
Also scroll down and enable the `Message Content Intent` and `Server Members Intent` so text commands work and discord.js doesn't error out.
Now, go back to your .env file and add this line:
```
DISCORD_TOKEN=(your discord token)
```
What we're essentially doing is defining a new environment variable called `DISCORD_TOKEN` that is set to `(your discord token)`.
## Inviting your bot to a Discord server.
This is the last stretch!
On the sidebar of the Discord Developer Portal, click `OAuth2` and then on `URL Generator`.
On scopes, tick only `bot`:
![](https://img.srizan.dev/brave_7ApMibw2KM.png)
Then on `Bot permissions` tick `Send Messages` and `Read Message History`. If you need others for your specific use-case, add them here.
![](https://img.srizan.dev/brave_7ApMibw2KM.png)
Finally, scroll down, copy the generated URL, paste it on the address bar and invite your bot as usual.
## Starting the bot
There's an npm script that's called `test`, so we're going to be running that.
Execute in your terminal:
```
yarn test
```
And your bot should start up in no time! Congrats!
---
Written by [Sr Izan](../intro/who-are-we#ethan)