rsurasin / snkrbot

A discord bot used to get information about shoes.
0 stars 1 forks source link

connection with discord? #1

Open Mx455 opened 2 years ago

Mx455 commented 2 years ago

Hi bro, I wanted to try your bot, how do I establish a connection with discord? I don't find information

rsurasin commented 2 years ago

Good afternoon @Mx455, sorry I didn't get to this sooner. So essentially I followed this tutorial to setup the discord bot using Python.

I recommend taking a look at that resource if you have the time. To summarize it for you, this is how you would create a connection with my code and a discord bot:

  1. Create a Discord account if you don't have one or login to an existing account using the developer portal
  2. Create a new application in the Discord developer portal. An application allows you to interact with Discord's API.
  3. In your newly created Discord application, on the sidebar navigate to Bot. Click on Add Bot to create a new bot user.
  4. Take note of the token associated with the bot user. You will need this token for my code to authenticate with that bot and allow users to communicate with it in your server.
  5. Ensure that you already have a Discord server in which you want this bot to join or create a new Discord server for this bot to join.
  6. In the Discord developer portal of your newly created Discord application, on the sidebar navigate to OAuth2. Here you will be able to add your bot user to your Discord server. Essentially, you'll be giving your bot user access to Discord's API by leveraging your Discord Application's OAuth2 credentials. Scroll down to the SCOPES section and check the bot option. Finally, go down to the BOT PERMISSIONS section and check appropriate level off access for your server/guild.
  7. Copy the application's authorization URL that Discord generated to you and paste it in the browser of your choosing. Select the guild/server that you want the bot user to join.
  8. Open up your terminal, and run the following command export DISCORD_TOKEN='<YOUR-DISCORD-BOT-TOKEN>'. This was obtained in step 4.
  9. Run python snkrbot.py

It will definitely be helpful to create a Python virtualenv because you will need to pip install the following libraries: requests, requests-html, and discord.py.

Hope this was helpful. If you have anymore questions, please feel free to ask. I've been busy with work and other projects so unfortunately haven't had the time to implement other features and improve the README.

rsurasin commented 2 years ago

Let me know if you get it working, and I will close this issue. I'll also make sure to merge the above into the README.