mirror of
https://github.com/snowy-yang/xiaonuan.git
synced 2026-10-21 08:04:48 +00:00
OneBot 11 适配器:反向 WS 接入 QQ(NapCat/Lagrange)
- app/onebot.py: /onebot/v11/ws 反向 WS;私聊全回、群聊仅回应 @她 并自动 @ 回去 - CQ 码字符串与消息段数组双格式解析;会话 id ob-<self_id>-p/g-<目标> 与 TUI 隔离 - action echo 配对调用(send_private_msg / send_group_msg),retcode==0 才落历史 - remember_later 的推送(事件确认/关怀/连续天数/身世)自动转成 QQ 消息 - 主动消息路由:push_proactive 优先 TUI、ob- 会话走 QQ,均不在线保持 pending - 主干重构:chat_turn() 供 TUI 与 OneBot 共用;助手消息由传输层确认送达后落库 - 可选 OB_ACCESS_TOKEN 令牌校验;8 个新测试(回复/CQ剥离/群@/通知转换/主动推送/令牌)
This commit is contained in:
1 parent
8bbab7e92b
commit
ea83b5df4b
6 files changed
+412
-80
No files matched your search
@@ -76,7 +76,7 @@ def test_streak_increments(fdb, offline):
|
||||
async def send_json(self, payload):
|
||||
pass
|
||||
|
||||
asyncio.run(main.remember_later(FakeWS(), "s1", "我来了", sig))
|
||||
asyncio.run(main.remember_later(FakeWS().send_json, "s1", "我来了", sig))
|
||||
assert asyncio.run(fdb.get_meta("s1", "streak")) == "4"
|
||||
|
||||
|
||||
@@ -89,5 +89,5 @@ def test_streak_resets_after_gap(fdb, offline):
|
||||
async def send_json(self, payload):
|
||||
pass
|
||||
|
||||
asyncio.run(main.remember_later(FakeWS(), "s1", "好久不见", sig))
|
||||
asyncio.run(main.remember_later(FakeWS().send_json, "s1", "好久不见", sig))
|
||||
assert asyncio.run(fdb.get_meta("s1", "streak")) == "1"
|
||||
Reference in new issue
Block a user