Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Discord Service Deployment - Production/Staging Env #27

Open
3 tasks
joyguptaa opened this issue Nov 25, 2024 · 1 comment
Open
3 tasks

Discord Service Deployment - Production/Staging Env #27

joyguptaa opened this issue Nov 25, 2024 · 1 comment
Assignees

Comments

@joyguptaa
Copy link
Contributor

joyguptaa commented Nov 25, 2024

How to Deploy Discord Service?

Deployment Process

The deployment process is divided into two main steps:

  1. Setting up the Discord Service with all the required environment variables.
  2. Deploying the Discord Service and updating the interaction URL on Discord.

Setting Up Queue Variables

2 env variables (required) depend upon deployment of discord-message-broker

  1. QUEUE_URL : URL of deployed queue
  2. QUEUE_NAME : Queue name from discord-message-broker

Discord Bot Setup

The Discord Bot setup requires a few environment variables to function properly. These include:

  1. PORT (Consider 8999 as default)
  2. DISCORD_PUBLIC_KEY
  3. GUILD_ID
  4. BOT_TOKEN

NOTE
These variables are essential for the bot to function correctly. You can configure them in your preferred way, such as in a .env file, Docker Compose file, or directly in your deployment environment. Ensure these variables are properly set up before running the service.

Getting Started

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

  1. Visit Discord Application

  2. Click on the "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, and this should open "General Information"

  5. If you scroll down, you will se PUBLIC KEY, copy it and place it in environment 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 the environment

  8. Now, we 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 the bot, a section to choose bot permission from, will show up
    Screenshot 2024-11-14 at 10 53 20 AM

  10. Check the following options

    1. Send Messages
    2. Change Nickname
    3. Manage Nickname
  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 into the browser, and a prompt will come up that will ask you to select your own "Discord Server"
    Screenshot 2024-11-14 at 11 00 45 AM

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

Running Discord Service using Docker

You can run the project using the Docker, using the following steps

  1. Compose the Image

    docker-compose up --build -d

    d here is to run the command in detach mode

  2. Remove the Image (Extra)
    If you are done with running the docker image and want to remove the image, run the command below

    docker-compose down

Running Discord Service using Docker

Once your Discord service is up and running, let’s assume it is accessible via one of the following URLs:

  1. https://<subdomain>.<domain>.com
  2. https://<host>:<port>

Steps to Configure the Interactions Endpoint

  1. Copy the URL of your running service (e.g., https://<subdomain>.<domain>.com or https://<host>:<port>).

  2. Open the General Information section of your bot in the Discord Developer Portal by clicking on bot's avatar or on name.

  3. Paste the copied URL into the Interactions Endpoint URL field and hit on save button.

    This URL is where Discord will send interaction events for your bot, such as commands or button clicks.
    Screenshot 2024-11-14 at 10 58 30 AM

  4. That’s it! 🚀 Your bot is ready to handle interactions. Try running a /hello command to test it out!

@prakashchoudhary07
Copy link
Contributor

prakashchoudhary07 commented Nov 29, 2024

@joyguptaa Both the links point to the same documentation.

@joyguptaa joyguptaa changed the title Discord Service Deployment - Staging Env Discord Service Deployment - Production Env Jan 27, 2025
@joyguptaa joyguptaa mentioned this issue Feb 1, 2025
3 tasks
@joyguptaa joyguptaa changed the title Discord Service Deployment - Production Env Discord Service Deployment - Production/Staging Env Feb 1, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants