feat: 增加 SafeW 已监控群列表接口
通过 getUpdates 将群写入 Redis,供创建/编辑渠道时选择 chat_id,避免前端重复传递 token。
This commit is contained in:
@@ -409,6 +409,41 @@ SMTP 使用全局 `config.yaml` 的 `smtp` 段;支持 587 STARTTLS / 465 TLS
|
||||
|
||||
`chat_id` 可为数字或字符串(含 `@username`)。消息以 MarkdownV2 发送:标题加粗,标题和正文均自动转义。
|
||||
|
||||
#### `POST /api/v1/channels/safew/chats` — 列出已监控的 SafeW 群
|
||||
|
||||
创建渠道时选群。Admin Key。用 `getUpdates` 攒到 Redis 里的群;bot 尚未在群里收到过更新时列表为空。
|
||||
|
||||
```json
|
||||
{
|
||||
"token": "<bot token>",
|
||||
"q": "测试AI"
|
||||
}
|
||||
```
|
||||
|
||||
`q` 可选,按群名 / username / chat_id 子串过滤(不区分大小写)。
|
||||
|
||||
**200:**
|
||||
|
||||
```json
|
||||
{
|
||||
"data": [
|
||||
{
|
||||
"id": "10000778141",
|
||||
"type": "group",
|
||||
"title": "测试AI",
|
||||
"username": null
|
||||
}
|
||||
],
|
||||
"total": 1
|
||||
}
|
||||
```
|
||||
|
||||
`id` 为字符串。Token 无效 → **401**。
|
||||
|
||||
#### `GET /api/v1/channels/:id/chats?q=` — 用已存 token 列群
|
||||
|
||||
编辑已有 safew 渠道。非 safew / 无 token → **400**;渠道不存在 → **404**。响应同上。
|
||||
|
||||
#### `GET /api/v1/channels` — 列表
|
||||
|
||||
Query:`page`、`page_size`。**200:** `{ "data": Channel[], "total", "page" }`
|
||||
|
||||
Reference in New Issue
Block a user