## What it is
nexium-discord is a Discord bot library for Nexium, written in Nexium over its standard library's std.http and std.websocket, with TLS from nxtls. A bot is a loop over bot.next(): the events it wants come back as values to match on, and everything the gateway needs to stay connected (identifying, heartbeats, resuming a dropped session, reconnecting with growing waits) happens inside. Answers go out through REST calls on the same bot, with Discord's rate limits waited out.
## What's in it
- The gateway: Discord's Gateway protocol (v10) as a state machine with no socket in it, so tests can run whole sessions on made-up clocks: heartbeats, resumes, Reconnect and Invalid Session, a connection that stops acknowledging heartbeats, and the close codes no retry fixes.
- Messages and interactions: messages built from parts (text, embeds, buttons, select menus, forms) with Discord's limits applied once, when they're built; slash commands with options, subcommands and autocomplete; and the answers to all of them.
- TLS: nxtls over the system's trusted roots, or the platform's own TLS (SChannel) on Windows, which keeps its roots in a store rather than a file.
## How it's tested
A scripted Discord plays through a transport of its own: a gateway session from Hello to a dispatch, a dropped connection resumed at the URL Discord gave, a refused token, a 429 waited out, slash commands registered. CI runs it on Linux, macOS and Windows, and it has been checked live from Linux and Windows, through both SChannel and nxtls. The gateway, message, interaction and command code come from a bot that has run on them since September 2026.
## Status
0.2.0 covers a bot's everyday: messages, slash commands and their answers, buttons, menus, forms and reactions. Not yet: sharding (for bots in more than 2,500 servers), voice, the gateway's zlib compression, and file uploads. It needs Nexium 1.4 or later, and runs on Linux, macOS, the BSDs and Windows.