autumn-plugin-discord
A Discord bot framework for Autumn apps: declare
slash commands as data, mount the signed interactions webhook, and answer
with typed responses. No heavyweight bot framework — just
ed25519-dalek for signature verification and reqwest for REST.
Quickstart
# Cargo.toml
[]
= { = "https://github.com/madmax983/autumn-plugin-discord" }
# autumn.toml
[]
= "123456789012345678"
= "<64 hex chars from the developer portal>"
use ;
use *;
async
async
Then, in the Discord developer portal:
- Set the Interactions Endpoint URL to
https://<your-host>/discord/interactions. - Register the command once:
cargo run --example register_commands. - Type
/pingin a server with the bot.
What the plugin installs
| Piece | Detail |
|---|---|
| Config section | [discord] — application_id, public_key. The bot token comes only from DISCORD_BOT_TOKEN. |
| Route | POST /discord/interactions — verifies the Ed25519 signature, answers PINGs, dispatches slash commands. |
| Extractor | VerifiedInteraction — mount your own endpoint when /discord/interactions does not fit. |
| Health | A "discord" health indicator backed by GET /applications/@me. |
| REST client | DiscordClient — register commands, send follow-ups for deferred interactions. |
| Gateway | GatewayClient — minimal websocket client: identify, heartbeat, event dispatch. Spawn it yourself; the plugin does not auto-connect. |
Deferred responses
Answer within 3 seconds, or acknowledge and follow up later:
use ;
async
Crate layout
| Module | Purpose |
|---|---|
config |
Layered [discord] config: file, env, builder overrides |
commands |
Slash-command declarations (Command), the CommandRegistry, dispatch |
interactions |
The webhook route and the VerifiedInteraction extractor |
verify |
Ed25519 signature verification (X-Signature-Ed25519 / X-Signature-Timestamp) |
client |
Discord REST client |
gateway |
Minimal gateway client (feature gateway, on by default) |
health |
GET /applications/@me readiness check |
plugin |
DiscordPlugin (::new(), .command(), .configure()) and DiscordRuntime |
error |
Error + ErrorKind + mapping to HTTP status codes |
Docs and comments
Written in ASD-STE100 style: short sentences, active voice, simple present tense.
Known issues
- The gateway client does not resume sessions. A dropped connection
reconnects with a fresh
Identify. Bots that need resume should extendgateway.rsor bring their own client. register_commandsoverwrites global commands. Global commands take up to an hour to propagate; guild-scoped registration is not wrapped yet.
Build status
All three quality gates pass as of 2026-09-29:
License
Apache-2.0. See LICENSE.