Skip to content

Latest commit

 

History

History
50 lines (38 loc) · 3.05 KB

File metadata and controls

50 lines (38 loc) · 3.05 KB

Discord Bot Setup

To setup a discord you first need to create an application (basically a bot), here are the steps to follow:

  1. Visit Discord Application

  2. Cick on "New Application" Button Screenshot 2024-11-08 at 1 52 53 AM

  3. Fill in your Application Name Screenshot 2024-11-08 at 1 52 53 AM

  4. Now here you will see your newly created application, click on it, this should open "General Information"

  5. If you scroll down, you will se PUBLIC KEY, copy it and place it .env as DISCORD_PUBLIC_KEY

  6. Now to create BOT_TOKEN, click on BOT > Reset Token Screenshot 2024-11-08 at 2 07 40 AM

  7. Once you have the token, place it against BOT_TOKEN in .env

  8. Now will be creating an invite URL and for that you need to click on OAuth2 > bot Screenshot 2024-11-13 at 11 40 21 PM

  9. Now as soon as you click on bot, a section to choose bot permission from, will shown up Screenshot 2024-11-14 at 10 53 20 AM

  10. Check the following options

    1. Send Messages
  11. Once you select all the bot permissions, scroll a bit down and you will see "Generated URL" Screenshot 2024-11-14 at 10 58 30 AM

  12. Copy and paste that URL in browser, a prompt will come up where it will ask you to select you own "Discord Server" Screenshot 2024-11-14 at 11 00 45 AM

  13. Once you add the Bot into your server, copy the "Server Id", by right clicking on the server avatar. Now place this id in .env against GUILD_ID

Connecting Discord Service with Discord

Now as you have created the discord bot, now its time to connect it with discord service using the following steps:

  1. You would need to register the commands first. That will be auto handled once you start the server
  2. Now start the server using
   make run #or go run .
  1. For IP tunneling, need to run NGROK, use the following command
   make ngrok #or ngrok http 8999

Since we are considering 8999 as default port for this service. If you wish to change it you can change it in Makefile & in docker-compose.yml

  1. Copy the Ngrok URL and open the General Information on Discord Developer Portal of your bot, paste the copied URL in Interactions Endpoint URL Screenshot 2024-11-14 at 10 58 30 AM
  2. All Set 🚀🚀🚀. Now you can start with running hello command