botkit
botkit is a Rust library for building chat bots with one handler model across multiple platforms.
The botkit crate is the facade entrypoint for the workspace. It re-exports botkit-core by
default and exposes platform adapters behind explicit feature flags.
Installation
Use the facade crate when you want one dependency with opt-in platforms:
[]
= { = "0.1.0", = ["telegram"] }
Available facade features:
discordenablesbotkit::discordand theDiscordBotre-exports.telegramenablesbotkit::telegramand theTelegramBotre-exports.matrixenablesbotkit::matrixand theMatrixBotre-exports.fullenables all platform adapters.
You can also depend on the smaller crates directly:
botkit-coreprovides the shared bot abstractions, extractors, handlers, and response types.botkit-discordprovides the Discord integration.botkit-telegramprovides the Telegram integration.botkit-matrixprovides the Matrix integration.
Quick start
# // Requires the `telegram` feature; the rest of the API is platform-agnostic.
#
#
Handlers are plain async functions. Their parameters are extractors
(User, Channel, CommandArgs, ButtonId, MessageContent, Typing,
Context), and their return type is anything that converts into a Response.
The same handler works on every platform.
To stop a bot on demand, use a shutdown signal instead of run:
# use *;
#
#
Design goals
- Reuse the same handler style across platforms.
- Keep the core abstractions transport-agnostic.
- Support async-first bot execution.
- Keep platform adapters opt-in instead of forcing heavy dependencies by default.
- Expose platform crates separately instead of hiding everything behind type erasure.
Crates
botkit
Facade crate that re-exports the core API and feature-gated platform integrations.
botkit-core
Shared building blocks:
Bot,BotBuilder, and theShutdown/ShutdownSignalpair- extractor-based handlers such as
User,CommandArgs, andMessageContent - unified
Response, embeds, components, and file responses
botkit-discord
Discord support built around gateway events and command, button, and message handlers. Registers slash commands on startup and reconnects (resuming the session, so no events are lost) on its own.
botkit-telegram
Telegram support for both long polling and webhook-style handling, plus bot client operations.
botkit-matrix
Matrix support built on top of matrix-sdk, including encrypted room support.
Reactions route through the same handler table as buttons.
Feature support by platform
| Discord | Telegram | Matrix | |
|---|---|---|---|
| Commands | slash commands | /command |
prefixed text (!command) |
| Command descriptions | registered on startup | setMyCommands |
not applicable |
| Buttons | message components | inline keyboards | emoji reactions |
| Structured command options | yes | no (string args) | no (string args) |
| Messages | needs MESSAGE_CONTENT intent |
yes | yes |
| Embeds | native | rendered as text | rendered as HTML |
| Files | attachments | documents | attachments |
| Ephemeral replies | yes | ignored | ignored |
| Typing indicator | yes | yes | yes |
Examples
The HTTP webhook examples live in their own workspace, because skyzen and
matrix-sdk each pull a package that links the system sqlite3 library and only
one may exist per build:
Status
This project is a library workspace under active development. The API surface is still evolving.