UnCLAS-Prommer 2025-04-11 23:17:12 +08:00
commit 199e37922a
2 changed files with 45 additions and 1 deletions

View File

@ -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] 接受消息解析

View File

@ -357,7 +357,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,