Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Composure

Composure is a Rust framework for Discord bots that answer Interactions over HTTP, with no gateway: served from Cloudflare Workers or any server. This guide walks through building one, chapter by chapter; every example in it is compiled as a test.

  1. Getting started: crates, features, a first bot, serving and syncing it
  2. Commands: #[command], Options, Choices, Groups, context menus, autocomplete, Scopes
  3. Responses: what handlers return; ephemeral messages, embeds, files, errors
  4. Components and modals: buttons, selects and forms with #[component], #[modal] and #[derive(Modal)], state in the custom_id
  5. Views: rsx! markup and #[view], with a reference of every tag and attribute
  6. REST and deferring: calling Discord’s API, follow-ups, Deferred Responses
  7. Webhook Events: app installs, entitlements, lobby messages
  8. Platforms: Adapters, State, platform-specific Commands, logging
  9. Testing: running handlers without Discord
  10. Local development, Deploying and Troubleshooting: running a bot, shipping it, and fixing it

The API documentation covers every type and function.

Terms like Command, Option, App, Route, Scope and Sync are capitalized when they mean Composure’s concept of them; see CONTEXT.md for the glossary, and docs/adr/ for why things are the way they are.