An example of stateless Discord Bot using Slash Commands feature and Cloudflare Workers.
- 🦀 Using Rust (with WebAssembly)!
- 🔌 You can create a stateless Discord Bot
- 🛠 Of course it is serverless
- 💰 Free for 100,000 requests with Cloudflare Workers
- Clone this repository.
- Copy
wrangler.example.toml
, then rename it towranger.toml
. - Edit the file, filling
account_id
andvars.PUBLIC_KEY
. - Deploy using
wrangler publish
. - Register your endpoint at Discord Developer Portal.
- Create an application command. For example:
$ curl \ -H "Authorization: Bot ${DISCORD_BOT_TOKEN}" \ -H "Content-Type: application/json" \ -d '{"name":"hello","description":"The bot will say \"Hello, world!\"."}' \ "https://discord.com/api/v8/applications/${APPLICATION_ID}/commands"
- Done!