mirror of
https://github.com/yibaiba/hideck.git
synced 2026-12-05 16:02:17 +00:00
docs(telegram): document bot onboarding
Describe BotFather token setup, authorized private-chat binding, MP3 verification, and the absence of a QR registration flow. Keep the config example and OpenAPI settings contract aligned with runtime behavior.
This commit is contained in:
1 parent
2bb7d661ad
commit
e8ea1fca4d
4 files changed
+37
-8
No files matched your search
@@ -80,26 +80,27 @@ docker compose logs -f hideck
|
||||
|
||||
不要把 SIM PIN、Bot Token、API Key 或其他凭据直接提交到配置仓库。SIM PIN 配置只保存环境变量名,例如 `HIDECK_SIM_PIN_READER1`。
|
||||
|
||||
### 微信、企业微信与 QQ 通知
|
||||
### Telegram、微信、企业微信与 QQ 通知
|
||||
|
||||
设置页的“通知”区域把个人微信、企业微信长连接机器人、企业微信 Webhook 和 QQ Bot 分开管理:
|
||||
设置页的“通知”区域把 Telegram Bot、个人微信、企业微信长连接机器人、企业微信 Webhook 和 QQ Bot 分开管理:
|
||||
|
||||
- Telegram:通过 `@BotFather` 的 `/newbot` 创建机器人并取得 Bot Token。填写管理员的 Telegram 数字用户 ID;通知 Chat ID 可留空,第一个已授权管理员私聊命令会自动绑定为默认通知目标。Telegram Bot API 使用 Token 接入,不提供机器人扫码注册。
|
||||
- 个人微信:在“个人微信”页签点击“扫码连接”。扫码确认后启用 iLink 通道;第一个合法私聊会成为默认通知目标。
|
||||
- 企业微信长连接:在“企微机器人”页签扫码创建机器人,也可以手工填写 Bot ID 和 Secret。第一个合法私聊会自动绑定,群聊不能抢占首次绑定。
|
||||
- QQ Bot:在“QQ Bot”页签扫码注册,也可以手工填写 App ID、App Secret 和目标 OpenID。扫码用户会自动成为管理员、私聊白名单和默认通知目标。
|
||||
- 企业微信 Webhook:继续在独立的“企微 Webhook”页签配置,只负责推送,不提供双向命令或扫码登录。
|
||||
|
||||
扫码服务不可用时,页面会显示真实错误并保留手工配置入口,不会伪造连接成功。个人微信和企业微信可用 `allowed_user_ids`、`allowed_group_ids` 限制命令来源;QQ 使用 `group_ids`、`direct_ids`。扫码凭证和自动绑定状态涉及敏感数据,`config/config.yaml` 与同目录的 `notification-state.json` 都不应提交或共享。
|
||||
扫码服务不可用时,页面会显示真实错误并保留手工配置入口,不会伪造连接成功。Telegram 使用 `admin_id` 限制私聊命令来源;个人微信和企业微信可用 `allowed_user_ids`、`allowed_group_ids`;QQ 使用 `group_ids`、`direct_ids`。Bot Token、扫码凭证和自动绑定状态涉及敏感数据,`config/config.yaml` 与同目录的 `notification-state.json` 都不应提交或共享。
|
||||
|
||||
连接后的人工验证步骤:
|
||||
|
||||
1. 从已授权的私聊发送 `/help`,回复顶部应列出实时设备 ID;后续命令必须使用这里显示的 ID。
|
||||
1. Telegram 先从管理员私聊发送 `/start`,其他双向渠道发送 `/help`;回复顶部应列出实时设备 ID,后续命令必须使用这里显示的 ID。Telegram 未显式配置 Chat ID 时,设置页刷新后应显示这个私聊的数字 ID。
|
||||
2. 发送 `/status <设备ID>`,确认普通文本命令可以双向收发。
|
||||
3. 发送 `/vocall <设备ID> <号码> [保持秒数]`。个人微信和 QQ 应收到真实 MP3 录音;企业微信对不超过 2 MiB 的 AMR-NB 发送语音,AMR-WB、MP3 或超限录音会按文件发送并说明原因。
|
||||
3. 发送 `/vocall <设备ID> <号码> [保持秒数]`。Telegram、个人微信和 QQ 应收到真实 MP3 录音;企业微信对不超过 2 MiB 的 AMR-NB 发送语音,AMR-WB、MP3 或超限录音会按文件发送并说明原因。
|
||||
4. 触发一条短信或来电通知,确认已绑定的默认私聊能够收到通知。
|
||||
5. 从不在白名单中的私聊或群聊发送命令,确认请求被拒绝;企业微信群聊不能用于首次绑定。
|
||||
5. 从不在白名单中的私聊或群聊发送命令,确认请求被拒绝;Telegram、个人微信和企业微信群聊不能用于首次绑定。
|
||||
|
||||
仓库自动测试覆盖扫码状态机、凭证加密/脱敏、配置持久化、长连接协议和本地媒体上传流程。真实微信、企业微信和 QQ 客户端仍需使用各自账号按上述步骤验收。
|
||||
仓库自动测试覆盖扫码状态机、凭证加密/脱敏、配置持久化、长连接协议和本地媒体上传流程。真实 Telegram、微信、企业微信和 QQ 客户端仍需使用各自账号按上述步骤验收。
|
||||
|
||||
## 源码构建
|
||||
|
||||
|
||||
@@ -38,6 +38,17 @@ vowifi:
|
||||
webhook:
|
||||
enabled: false
|
||||
|
||||
# Telegram 机器人通过 @BotFather 创建,不使用扫码注册。
|
||||
# admin_id 是允许执行命令的 Telegram 数字用户 ID;chat_id 留 0 时,首次授权私聊会自动绑定。
|
||||
# 自动绑定目标保存在同目录 notification-state.json。不要提交包含真实 Bot Token 的配置文件。
|
||||
telegram:
|
||||
enabled: false
|
||||
bot_token: ""
|
||||
admin_id: 0
|
||||
chat_id: 0
|
||||
base_url: ""
|
||||
proxy: ""
|
||||
|
||||
# QQ Bot 可在设置页扫码注册,也可手工填写以下字段。
|
||||
qq:
|
||||
enabled: false
|
||||
|
||||
@@ -4279,16 +4279,30 @@ components:
|
||||
type: boolean
|
||||
bot_token:
|
||||
type: string
|
||||
description: BotFather 签发的 Bot Token;读取已保存配置时返回脱敏值 ********,保存该占位时保留原值
|
||||
chat_id:
|
||||
type: integer
|
||||
format: int64
|
||||
description: 可选的固定通知目标;为 0 时由授权管理员首次私聊自动绑定
|
||||
admin_id:
|
||||
type: integer
|
||||
format: int64
|
||||
description: 允许执行私聊命令并触发首次绑定的 Telegram 数字用户 ID
|
||||
bound_chat_id:
|
||||
type: integer
|
||||
format: int64
|
||||
readOnly: true
|
||||
description: 当前实际通知目标,优先返回固定 chat_id,否则返回持久化的私聊绑定
|
||||
binding_error:
|
||||
type: string
|
||||
readOnly: true
|
||||
description: 读取持久化绑定状态失败时的明确错误
|
||||
base_url:
|
||||
type: string
|
||||
description: 可选 Bot API 反向代理模板
|
||||
proxy:
|
||||
type: string
|
||||
description: 可选 HTTP 代理地址
|
||||
|
||||
FeishuSettings:
|
||||
type: object
|
||||
|
||||
@@ -49,7 +49,10 @@ func TestOpenAPIHiDeckYAMLValid(t *testing.T) {
|
||||
if !strings.Contains(string(data), "enum: [at, qmi, mbim, pcsc]") {
|
||||
t.Fatal("openapi.hideck.yaml missing MBIM/PCSC device and eSIM transport contract")
|
||||
}
|
||||
for _, field := range []string{"wecom_bot:", "allowed_group_ids:", "manual_setup_available:"} {
|
||||
for _, field := range []string{
|
||||
"wecom_bot:", "allowed_group_ids:", "manual_setup_available:",
|
||||
"bound_chat_id:", "BotFather 签发的 Bot Token", "授权管理员首次私聊自动绑定",
|
||||
} {
|
||||
if !strings.Contains(string(data), field) {
|
||||
t.Fatalf("openapi.hideck.yaml missing notification field %s", field)
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user