From a4015b6b132c6cc1d204bcab745c57f8998e0460 Mon Sep 17 00:00:00 2001 From: ChangingSelf Date: Wed, 9 Apr 2025 22:25:52 +0800 Subject: [PATCH 1/2] =?UTF-8?q?docs(README):=20README=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E6=B6=88=E6=81=AF=E6=B5=81=E8=BD=AC=E6=97=B6=E5=BA=8F=E5=9B=BE?= =?UTF-8?q?=EF=BC=88mermaid=EF=BC=89=EF=BC=8C=E4=BB=A5=E4=BE=BF=E4=BD=BF?= =?UTF-8?q?=E7=94=A8=E8=80=85=E7=90=86=E8=A7=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 44 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) diff --git a/README.md b/README.md index a9b1937..134bdad 100644 --- a/README.md +++ b/README.md @@ -31,6 +31,50 @@ enable_temp = false 至于requirements,需要maim_message,安装略 +# 消息流转过程 + +```mermaid +sequenceDiagram + participant Napcat as Napcat客户端 + participant Adapter as MaiBot-Napcat适配器 + participant Queue as 消息队列 + participant Handler as 消息处理器 + participant MaiBot as MaiBot服务 + + Note over Napcat,MaiBot: 初始化阶段 + Napcat->>Adapter: WebSocket连接(ws://localhost:8095) + Adapter->>MaiBot: WebSocket连接(ws://localhost:8000) + + Note over Napcat,MaiBot: 心跳检测 + loop 每30秒 + Napcat->>Adapter: 发送心跳包 + Adapter->>Napcat: 心跳响应 + end + + Note over Napcat,MaiBot: 消息处理流程 + Napcat->>Adapter: 发送消息 + Adapter->>Queue: 消息入队(message_queue) + Queue->>Handler: 消息出队处理 + Handler->>Handler: 解析消息类型 + alt 文本消息 + Handler->>MaiBot: 发送文本消息 + else 图片消息 + Handler->>MaiBot: 发送图片消息 + else 混合消息 + Handler->>MaiBot: 发送混合消息 + else 转发消息 + Handler->>MaiBot: 发送转发消息 + end + MaiBot-->>Adapter: 消息响应 + Adapter-->>Napcat: 消息响应 + + Note over Napcat,MaiBot: 优雅关闭 + Adapter->>MaiBot: 关闭连接 + Adapter->>Queue: 清空消息队列 + Adapter->>Napcat: 关闭连接 +``` + + # TO DO List - [x] 读取自动心跳测试连接 - [x] 接受消息解析 From d1a1763dc00568374b16a9f98115d1ee56c22143 Mon Sep 17 00:00:00 2001 From: Dreamwxz Date: Fri, 11 Apr 2025 21:07:19 +0800 Subject: [PATCH 2/2] Update recv_handler.py MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 修复@任何人都@bot --- src/recv_handler.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/recv_handler.py b/src/recv_handler.py index 9a793f2..173b9f4 100644 --- a/src/recv_handler.py +++ b/src/recv_handler.py @@ -353,7 +353,7 @@ class RecvHandler: else: return None else: - member_info: dict = await get_member_info(self.server_connection, group_id=group_id, user_id=self_id) + member_info: dict = await get_member_info(self.server_connection, group_id=group_id, user_id=qq_id) if member_info: return Seg( type=RealMessageType.text,