ssMMiles / discord-interactions-worker

An example Discord bot ready to deploy to Cloudflare Workers, made using the discord-interactions framework.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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.

About

An example Discord bot ready to deploy to Cloudflare Workers, made using the discord-interactions framework.


Languages

Language:TypeScript 100.0%