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!