A Discord Bot to show some thanks
- A Cloudflare account for the Workers
- A Discord app with the permissions to send messages and use slash commands
- See configuration instructions from the Discord sample
- The "Interactions Endpoint URL" under "General Information" should be set to your CF Workers URL
Run npm run deploy
and then follow the instructions to auth with your Cloudflare account.
This will fail after auth until you configure Hyperdrive, continue following these instructions.
Follow the instructions in https://developers.cloudflare.com/workers/ci-cd/external-cicd/github-actions/ to generate an account ID and API token.
These should be set in an Actions environment matching the deploy workflow (🛠️
if you're using this repo's deploy workflow.)
CLOUDFLARE_ACCOUNT_ID
CLOUDFLARE_API_TOKEN
Create a .dev.vars
file with the following values
DISCORD_APPLICATION_ID:
DISCORD_PUBLIC_KEY:
DISCORD_TOKEN:
These should also be set in your Cloudflare project:
npx wrangler secret put DISCORD_APPLICATION_ID
npx wrangler secret put DISCORD_PUBLIC_KEY
npx wrangler secret put DISCORD_TOKEN
Create a PlanetScale database named ty
using your preferred method of choice.
https://planetscale.com/docs/tutorials/planetscale-quick-start-guide
Run the commands in schema.sql
in a pscale shell
or Web Console to set up your database.
Create a read/write
password in Planetscale for your database and save the connection URL in .dev.vars
DATABASE_URL=
Then, set up Hyperdrive with wrangler
:
npx wrangler hyperdrive create tydb --connection-string="<DATABASE_URL>"
Save the resulting Hyperdrive binding id as CLOUDFLARE_HYPERDRIVE_ID
in your .dev.vars
and in your Actions
environment.
Run script/setup-wrangler
to create the wrangler.jsonc
file with this secret.
Now deploy your worker with npm run deploy
.