discord
A Discord bot's back end over the HTTP API (v10), and the Interactions Endpoint as one checked route. The whole of it is docs/discord.md.
use "pkg:discord/discord.mote" // the API, and the shapes of messages, embeds, components, commandsuse "pkg:discord/interactions.mote" // POST /discord/interactions (takes discord.mote)discordPost("123", {content: "Deployed", embeds: [discordEmbed("v42", "is out")]}, "")?fn discordCommand(i: DiscordInteraction): DiscordOut // the program's hooks, each optionalSettings: DISCORD_BOT_TOKEN (a secret), DISCORD_APP_ID,
DISCORD_PUBLIC_KEY; DISCORD_WAIT, DISCORD_TOLERANCE, DISCORD_API.
| File | |
|---|---|
discord.mote | The calls, the shapes, the buckets and the global limit. |
interactions.mote | The route: Ed25519 checked, PING, answers at once, deferred work in jobs. |
tests.mote | Its tests (RFC 8032's Ed25519 vectors among them): use "pkg:discord/tests.mote", then mote test (tests/svc_chat/unit.mote). |
Covered: messages (send, reply, edit, delete, react, a page of a channel's, a DM) with embeds, buttons, selects and files, mentions off unless said; channels, threads from a message; members page by page, roles given and taken with an audit-log reason; webhooks out, waited for; slash commands (with options, choices, subcommands) registered by bulk overwrite, for a server or everywhere; interactions (commands, components, modals, autocomplete), answered at once or deferred to a job and the reply edited in or followed up; buckets and the global limit kept and waited out by every caller.
Left out on purpose: the Gateway (messages as they are posted, presence,
voice: the back end's WebSocket client, ws.open, is there now; what remains
is the Gateway's own protocol: identify, heartbeats, resume, sharding), OAuth, voice, stickers,
scheduled events, auto-moderation, monetization, components v2.
Not yet run against Discord: only against a stand-in
(tests/all.sh real_svc_chat), and Ed25519 against RFC 8032's vectors.
extensions/discord/README.md