对接Napcat的麦麦Adapter
 
 
Go to file
UnCLAS-Prommer c0416a517e logger change (hope it dont crash) 2025-07-01 16:25:54 +08:00
.devcontainer add postCreateCommand in devcontainer.json 2025-05-09 13:37:28 +09:00
.github/workflows ci(docker): 更新 Docker镜像标签命名规则 2025-04-11 18:01:38 +08:00
src logger change (hope it dont crash) 2025-07-01 16:25:54 +08:00
template 配置文件版本更新 2025-06-24 15:10:11 +08:00
.gitignore 修bug,改版本号 2025-06-28 11:44:35 +08:00
Dockerfile fix(Dockerfile): 修正dockerfile 2025-04-09 11:35:25 +08:00
LICENSE Initial commit 2025-04-06 01:30:02 +08:00
README.md 更新文档,顺便补一个缺失依赖项 2025-06-28 14:37:22 +08:00
command_args.md 更新文档,顺便补一个缺失依赖项 2025-06-28 14:37:22 +08:00
main.py 语音消息识别 2025-06-30 18:17:07 +08:00
notify_args.md REFACTOR 与禁言检测 2025-06-28 01:54:03 +08:00
pyproject.toml 语音消息识别 2025-06-30 18:17:07 +08:00
requirements.txt 更新文档,顺便补一个缺失依赖项 2025-06-28 14:37:22 +08:00

README.md

MaiBot 与 Napcat 的 Adapter

运行方式:独立/放在MaiBot本体作为插件

使用说明

请参考官方文档

消息流转过程

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

  • 读取自动心跳测试连接

  • 接受消息解析

    • 文本解析
    • 图片解析
    • 文本与消息混合解析
    • 转发解析(含图片动态解析)
    • 群公告解析
    • 回复解析
    • 群临时消息(可能不做)
    • 链接解析
    • 戳一戳解析
      • 读取戳一戳的自定义内容
    • 语音解析(?)
    • 所有的notice类
      • 撤回(已添加相关指令)
  • 发送消息

    • 发送文本
    • 发送图片
    • 发送表情包
    • 引用回复(完成但是没测试)
    • 戳回去(?)
    • 发送语音
  • 使用echo与uuid保证消息顺序

  • 执行部分管理员功能

    • 禁言别人
    • 全体禁言
    • 群踢人功能

    特别鸣谢

    特别感谢@Maple127667对本项目代码思路的支持

    以及@墨梓柒对部分代码想法的支持