Discord Bot Setup

1. Navigate to the Application page on Discord: https://discord.com/developers/applications

2. In the top right, click “New Application” and enter a name for the application. Skip filling out other information for now.

3. Click the “Bot” tab on the left navigation bar, then “Add a bot” and confirm you want a bot.

This new “Bot” page will be where you can actually change the display name and icon for the bot on Discord. Pick a distinctive bot name. (We're about to have a lot of bots at once!)

Under Authorization Flow, move the slider left to disable “Public Bot” functionality.

4. Now go to the OAuth tab on the left navigation bar. Under Scopes, check “bot”. Then, scroll down further to the Bot Permissions and check “View Channels” as well as all the text permissions you can. (You probably won’t need most of these.)

5. Scroll up again to the Scopes panel. At the bottom, there should be a URL. This url will encode a request to authorize this bot for a Discord server for the permissions selected in the window below. Click the “Copy” button or copy the URL text yourself. (Note that these permissions don’t get saved by the bot, they’re just baked into the URL; if you need to repeat this process, you will need to re-check these boxes prior to copying the URL.)

6. Paste this URL into your browser. This should ask you first to select which server you are authorizing the Bot for; select CS 159 Spring 2021. Then, confirm that it lists the permissions you gave it in step 4 and click “Authorize.”

7. Go to the Discord for CS 159 -- your bot should now be in the list of users! To ensure your bot doesn't spam the main channels, please click the bot's name on the right, then click the + under Roles and add "Bots".

8. In the original "Bot" tab you accessed in Step 3, you should see a section labeled Token. Copy the token from there and paste it into the discordbot.py file where it asks for the token.

Congratulations! Your bot is now a user on the Discord server! The lab instructions will tell you what to do in order to actually start sending and receiving messages from that bot account.