Skip to content

Latest commit

 

History

History
62 lines (51 loc) · 2.25 KB

README.md

File metadata and controls

62 lines (51 loc) · 2.25 KB

Discord Bot - Cloudflare Worker Template

Discord server Tests status

A template Discord bot made using @discord-interactions.

Deploy to Cloudflare Workers

Getting Started

Cloning the repo

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

Installing and setting up Wrangler

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.

Filling in secrets

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

Development

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

Production

To deploy, just use npm run deploy.