Skip to content
Jingzhe

Type-safe Rust × Telegram Bot API

Build Telegram bots with Rust, clearly.

Declarative, async, and type-safe from request to route.
src/main.rs
use jingzhe::{Bot, Context, command};
#[command(description = "Start")]
async fn start(context: Context) -> anyhow::Result<()> {
context.reply("Hello from Jingzhe!").await?;
Ok(())
}
#[tokio::main]
async fn main() -> anyhow::Result<()> {
Bot::new(token)?
.command(start)
.run_polling()
.await?;
Ok(())
}

One entry point for requests, routing, and runtime

Section titled “One entry point for requests, routing, and runtime”

Jingzhe combines Telegram Bot API requests, command handling, and message routing behind the same Bot entry point. Send typed requests directly, or build a complete bot with command macros, shared state, and typed callbacks.

Declarative commands

Define commands with #[command], then reply and access application state through Context.

Typed API

Build requests and read responses with Rust types. Optional parameters use builders.

Typed callbacks

Define callback payloads with #[derive(CallbackData)] and route each action to a handler.

Two update modes

Use long polling with graceful shutdown, or opt into an Axum webhook with the webhook feature.

The current release is 0.1.0, targeting Telegram Bot API 10.5. Every Rust method and type links to the corresponding Telegram documentation.