Skip to content
This repository was archived by the owner on Mar 11, 2026. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 17 additions & 1 deletion en/platform/telegram.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,20 @@ Fill in the configuration fields that appear:
- Enable: Check this option.
- Bot Token: Your Telegram bot's `token`.

Please ensure your network environment can access Telegram. You may need to configure a proxy using `Configuration -> Other Settings -> HTTP Proxy`.
Please ensure your network environment can access Telegram. You may need to configure a proxy using `Configuration -> Other Settings -> HTTP Proxy`.

## Streaming Output

The Telegram platform supports streaming output. Enable the "Streaming Output" switch in "AI Configuration" -> "Other Settings".

### Private Chat Streaming

In private chats, AstrBot uses the `sendMessageDraft` API (added in Telegram Bot API v9.3) for streaming output. This displays a "typing" draft preview animation in the chat interface, creating a more natural "typewriter" effect. It avoids issues with the traditional approach such as message flickering, push notification interference, and API edit frequency limits.

### Group Chat Streaming

In group chats, since the `sendMessageDraft` API only supports private chats, AstrBot automatically falls back to the traditional `send_message` + `edit_message_text` approach.

:::warning
`sendMessageDraft` requires `python-telegram-bot>=22.6`.
:::
18 changes: 17 additions & 1 deletion zh/platform/telegram.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,20 @@
- 启用(enable): 勾选。
- Bot Token: 你的 Telegram 机器人的 `token`。

请确保你的网络环境可以访问 Telegram。你可能需要使用 `配置页->其他配置->HTTP 代理` 来设置代理。
请确保你的网络环境可以访问 Telegram。你可能需要使用 `配置页->其他配置->HTTP 代理` 来设置代理。

## 流式输出

Telegram 平台支持流式输出。需要在「AI 配置」->「其他配置」中开启「流式输出」开关。

### 私聊流式输出

在私聊中,AstrBot 使用 Telegram Bot API v9.3 新增的 `sendMessageDraft` API 实现流式输出。这种方式会在私聊界面展示一个「正在输入」的草稿预览动画,体验更接近「打字机」效果,且避免了传统方案的消息闪烁、推送通知干扰和 API 编辑频率限制等问题。

### 群聊流式输出

在群聊中,由于 `sendMessageDraft` API 仅支持私聊,AstrBot 会自动回退到传统的 `send_message` + `edit_message_text` 方案。

:::warning
`sendMessageDraft` 功能需要 `python-telegram-bot>=22.6`。
:::