Examples
Repository examples live in crates/jingzhe/examples.
| Example | Coverage |
|---|---|
get_me |
Bot information and the smallest API request |
polling |
Commands, shared state, message handling, and typed button callbacks |
files |
Uploading, downloading, and reusing Telegram files |
full_api |
Typed messages, rich messages, Widgets, and Inline Mode |
webhook |
Standalone Axum webhook service |
axum_integration |
Merge webhook routes into an existing Axum service |
Run examples
Section titled “Run examples”Regular examples:
cargo run -p jingzhe --example get_mecargo run -p jingzhe --example pollingcargo run -p jingzhe --example filescargo run -p jingzhe --example full_apiWebhook examples require the feature:
cargo run -p jingzhe --features webhook --example webhookcargo run -p jingzhe --features webhook --example axum_integrationEnvironment variables
Section titled “Environment variables”Copy the configuration template from the repository root:
cp -n .env.example .envAt minimum:
TELEGRAM_BOT_TOKEN=replace-with-your-bot-tokenThe file examples also need TELEGRAM_CHAT_ID and UPLOAD_PATH. Webhook examples also need WEBHOOK_URL and WEBHOOK_SECRET.