40cba6a567
Extend getUpdates parsing for group joins and update settings UI hints so Chat ID detection works for supergroups, not only private DMs.
1.1 KiB
1.1 KiB
Telegram Chat ID 群聊检测修复
日期:2026-06-13
变更摘要
修复设置页「检测 Chat ID」无法识别群聊的问题:扩展 getUpdates 解析,覆盖 Bot 被拉入群时的 my_chat_member 等更新类型;更新前端操作说明。
动机
用户反馈群聊 Chat ID 检测不到。原实现仅从 message / channel_post 取 chat,而群聊常见首条可见更新为 my_chat_member(Bot 入群),导致列表为空。
涉及文件
server/api/settings.py—_telegram_chat_entry、_extract_chats_from_telegram_updates、_telegram_fetch_chats(limit 100,最多返回 10 条,群组优先)frontend/src/pages/SettingsPage.vue— 群聊检测说明、空状态文案、类型中文标签tests/test_settings_telegram.py— 群聊/编辑消息/callback 解析单测
迁移 / 重启
无需数据库迁移;部署后端 + 前端后生效。
验证方式
pytest tests/test_settings_telegram.py -q
生产:将 Bot 拉入测试群 → 群内发送 /start@Bot用户名 → 设置页点击「检测 Chat ID」应出现群组项(负 ID)。