Skip to content

kavisherlock/kavibot

Repository files navigation

valorant-battles

Running app locally

Before you start, you'll need to create a Discord app with the proper permissions:

  • applications.commands
  • bot (with Send Messages enabled)

Configuring the app is covered in detail in the getting started guide.

Setup project

Then navigate to its directory and install dependencies:

cd valorant-battles
npm install

Get app credentials

Fetch the credentials from your app's settings and add them to a .env file (see .env.sample for an example). You'll need your app ID (APP_ID), server ID (GUILD_ID), bot token (DISCORD_TOKEN), and public key (PUBLIC_KEY).

Fetching credentials is covered in detail in the getting started guide.

🔑 Environment variables can be added to the .env file in Glitch or when developing locally, and in the Secrets tab in Replit (the lock icon on the left).

Run the app

After your credentials are added, go ahead and run the app:

node app.js

⚙️ A package like nodemon, which watches for local changes and restarts your app, may be helpful while locally developing.

Set up interactivity

The project needs a public endpoint where Discord can send requests. To develop and test locally, you can use something like ngrok to tunnel HTTP traffic.

Install ngrok if you haven't already, then start listening on port 3000:

ngrok http 3000
https://valorant-battles.fly.dev

You should see your connection open:

Tunnel Status                 online
Version                       2.0/2.0
Web Interface                 http://127.0.0.1:4040
Forwarding                    http://1234-someurl.ngrok.io -> localhost:3000
Forwarding                    https://1234-someurl.ngrok.io -> localhost:3000

Connections                  ttl     opn     rt1     rt5     p50     p90
                              0       0       0.00    0.00    0.00    0.00

Copy the forwarding address that starts with https, in this case https://1234-someurl.ngrok.io, then go to your app's settings.

On the General Information tab, there will be an Interactions Endpoint URL. Paste your ngrok address there, and append /interactions to it (https://1234-someurl.ngrok.io/interactions in the example).

Click Save Changes, and your app should be ready to run 🚀

Fly.io Deploment Commands

curl -L https://fly.io/install.sh | sh
export FLYCTL_INSTALL="/home/kavish/.fly"
export PATH="$FLYCTL_INSTALL/bin:$PATH"
flyctl auth login
fly deploy

https://fly.io/apps/valorant-battles/monitoring

About

Discord Bot with some fun/useful custom commands

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published