A serverless Discord bot to act as a frontend to the API, using Discord slash commands and a Cloudflare worker.
Create the config files:
$ cp wrangler.toml.example wrangler.toml $ cp project_config.ts.example project_config.ts
Install Node JS.
Install dependencies with
npm install --save-dev.Authenticate
wrangler:npx wrangler login.Get your account ID with
npx wrangler whoami, then replace the account ID inwrangler.tomlwith it.Fill in the values in
project_config.ts. Some values can be found on the Discord Developer Portal, others by contacting the Polympics server admin.Run
npm run registerto register the available commands with Discord.Run
npx wrangler publishto publish!
Please make sure to format code with npm run format before committing. You can run a local server with npx wrangler dev, but for this to be any use Discord requires that it must run over HTTPS, which I haven't worked out yet. I recommend just running a test copy of the worker and getting logs with npx wrangler tail.