stateless-discord-bot
stateless-discord-bot copied to clipboard
An example of stateless Discord Bot using Slash Commands feature and Cloudflare Workers.
🧲 Stateless Discord Bot
An example of stateless Discord Bot using Slash Commands feature and Cloudflare Workers.
✨ Features
- 🦀 Using Rust (with WebAssembly)!
- 🔌 You can create a stateless Discord Bot
- 🛠 Of course it is serverless
- 💰 Free for 100,000 requests with Cloudflare Workers
📦 Installation
- Clone this repository.
- Copy
wrangler.example.toml, then rename it towranger.toml. - Edit the file, filling
account_idandvars.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!