[ PROMPT_NODE_25564 ]
api_methods
[ SKILL_DOCUMENTATION ]
# Telegram Bot API - 方法完整参考
> 基于 Bot API 9.4 (2026年2月)。基础 URL: `https://api.telegram.org/bot/METHOD_NAME`
---
## 获取更新
| 方法 | 描述 |
|---|---|
| `getUpdates` | 长轮询。返回 `Update` 对象数组。使用 `offset` 确认接收,`timeout` 进行长轮询,`allowed_updates` 进行过滤。 |
| `setWebhook` | 设置 HTTPS URL 以接收更新。端口:443, 80, 88, 8443。支持 `secret_token` 头部验证。`ip_address` 用于 DNS 变通。`max_connections` (1-100, 默认 40)。 |
| `deleteWebhook` | 移除 Webhook 集成。可选 `drop_pending_updates`。 |
| `getWebhookInfo` | 获取当前 Webhook 状态:URL、待处理数量、最后错误、允许的更新。 |
**轮询 vs Webhook 决策:**
- **轮询** (`getUpdates`): 设置简单,适合开发,无需 HTTPS。将 `timeout` 设置为 30+ 以提高长轮询效率。
- **Webhook** (`setWebhook`): 更适合生产环境,延迟更低,需要 HTTPS。使用 `secret_token` 进行验证。
---
## 智能体身份与命令
| 方法 | 描述 |
|---|---|
| `getMe` | 返回基本的智能体信息 (id, name, username, can_join_groups 等) |
| `logOut` | 在切换到本地服务器前从云端 Bot API 登出。 |
| `close` | 优雅地关闭智能体实例。 |
| `setMyCommands` | 注册菜单中可见的智能体命令。接受 `commands[]` 和 `scope` (默认、私聊、群组、特定聊天等) 以及 `language_code`。 |
| `deleteMyCommands` | 移除给定范围/语言的命令。 |
| `getMyCommands` | 获取当前范围/语言的命令列表。 |
| `setMyName` | 按语言设置智能体显示名称(最多 64 字符)。 |
| `getMyName` | 获取智能体显示名称。 |
| `setMyDescription` | 在空聊天中显示的智能体描述(最多 512 字符)。 |
| `getMyDescription` | 获取智能体描述。 |
| `setMyShortDescription` | 用于分享的简短描述(最多 120 字符)。 |
| `getMyShortDescription` | 获取简短描述。 |
| `setMyDefaultAdministratorRights` | 设置添加到群组/频道时的默认管理员权限。 |
| `getMyDefaultAdministratorRights` | 获取默认管理员权限。 |
| `setMyProfilePhoto` | 更新智能体头像。 |
| `removeMyProfilePhoto` | 删除智能体头像。 |
---
## 发送消息
### 文本与格式化
| 方法 | 描述 |
|---|---|
| `sendMessage` | 发送文本消息。支持 `parse_mode` (HTML, Markdown, MarkdownV2), `entities`, `link_preview_options`, `reply_markup`, `reply_parameters`, `me