A template Discord bot made using @discord-interactions.
You can either use degit to locally clone this repo without git, or create a new repo from this template and clone that.
npx degit ssMMiles/discord-interactions-worker
After that, make sure to install dependencies using npm:
npm install
Make sure to sign up for a Cloudflare Workers account in a browser before continuing. Install wrangler with npm or yarn:
npm install -D wrangler@latest
# yarn global add wrangler@latest
Read more about installing wrangler.
Afterwards, run wrangler login
to login to your Cloudflare account with OAuth:
wrangler login
Copy wrangler.toml.example
into wrangler.toml
and edit it as you'd like.
You can enter in environment secrets with wrangler secret put
, here are the keys that are required to run this:
npx wrangler secret put CLIENT_ID
npx wrangler secret put PUBLIC_KEY
npx wrangler secret put TOKEN
To run this locally, copy .dev.vars.example
to .dev.vars
and fill in those values.
You can then either:
# Run a version of your worker listening locally
wrangler dev
# If you have Ngrok configured to work with SSH,
# this will run `wrangler dev` and open a tunnel for remote access
npm run dev
To deploy, just use npm run deploy
.