跳转到内容
Jingzhe

示例

仓库示例位于 crates/jingzhe/examples。

示例 内容
get_me 查询机器人信息,了解最小 API 请求
polling 命令、共享状态、消息处理与类型化按钮回调
files 上传、下载与复用 Telegram 文件
full_api 类型化事件宏、富消息、Widgets 与 Inline Mode
webhook 独立运行 Axum Webhook 服务
axum_integration 将 Webhook 路由接入已有 Axum 服务

普通示例:

终端
cargo run -p jingzhe --example get_me
cargo run -p jingzhe --example polling
cargo run -p jingzhe --example files
cargo run -p jingzhe --example full_api

Webhook 示例需要启用 feature:

终端
cargo run -p jingzhe --features webhook --example webhook
cargo run -p jingzhe --features webhook --example axum_integration

在仓库根目录复制配置模板:

终端
cp -n .env.example .env

至少填写:

.env
TELEGRAM_BOT_TOKEN=替换为你的BotToken

文件示例还需要 TELEGRAM_CHAT_ID 和 UPLOAD_PATH。Webhook 示例还需要 WEBHOOK_URL 和 WEBHOOK_SECRET。