
开源推荐 | 基于Spring Boot的智能机器人框架——WiseRobot前言大家好今天给大家推荐一个功能强大的智能机器人开源项目——WiseRobot。该项目基于Spring Boot开发集成了CoolQ、WebSocket、插件系统等核心功能可以轻松实现QQ/微信群管理、消息处理、自动化客服等功能。项目简介WiseRobot 是一个现代化的即时通讯机器人框架采用微服务架构设计支持多种消息渠道的统一处理。项目代码结构清晰遵循阿里编码规范便于二次开发和维护。技术栈后端框架: Spring Boot 2.x消息协议: CoolQ HTTP API通信方式: WebSocket数据存储: 支持扩展可接入MySQL、MongoDB等核心库:Lombok简化代码Hutool工具集FastJSONJSON处理核心功能1. 插件系统项目采用灵活的插件架构支持按顺序执行多个插件publicclassPluginConfig{publicstaticListCQPluginpluginListnewArrayList();static{pluginList.add(newStatusPlugin());// 状态监控pluginList.add(newPrefixPlugin());// 对话控制pluginList.add(newExportPlugin());// 数据导出pluginList.add(newExamplePlugin());// 示例插件pluginList.add(newFilePlugin());// 群文件管理}}2. 事件处理统一的事件处理机制支持多种事件类型消息事件: 私聊消息、群消息、讨论组消息请求事件: 加好友请求、加群请求通知事件: 群成员变动、群禁言、文件上传等元事件: 心跳检测、生命周期3. 多渠道消息发送统一的消息发送接口支持QQ和微信ServicepublicclassUnifiedMessageService{AutowiredprivateWeChatMessageSenderweChatSender;AutowiredprivateQQMessageSenderqqSender;publicvoidsendMessage(ClientTypeEnumclientType,EventMessageTypeEnummessageType,StringtargetId,Stringcontent){// 根据渠道选择对应的发送器}}4. 敏感词过滤内置Trie树算法实现的高效敏感词过滤ComponentpublicclassBusinessPluginRegistry{privateTrietrienewTrie();publicvoidloadSensitiveWords(ListStringwords){words.forEach(trie::insert);}publicbooleancontainsSensitiveWord(Stringtext){returntrie.search(text);}}项目结构src/main/java/com/eul/web/ ├── bot/ # 机器人业务插件 │ ├── plugin/ # 插件实现 │ └── entity/ # 实体类 ├── cq/ # CoolQ相关 │ ├── event/ # 事件定义 │ ├── entity/ # 实体类 │ ├── retdata/ # 返回数据 │ ├── robot/ # 核心机器人类 │ └── websocket/ # WebSocket处理 ├── config/ # 配置类 ├── controller/ # 控制器 ├── domain/ # 领域模型 ├── factory/ # 工厂模式 ├── plugin/ # 插件系统 └── service/ # 服务层快速开始克隆项目gitclone https://gitee.com/blps/wise-robot.git配置application.yamlserver:port:8888spring:application:name:wx-robot运行项目mvn spring-boot:run配置CoolQ安装 CoolQ Pro 或 CoolQ HTTP API 插件配置 WebSocket 地址ws://127.0.0.1:8888/ws/插件开发示例创建一个简单的插件只需继承CQPluginpublicclassMyPluginextendsCQPlugin{OverridepublicintonPrivateMessage(CoolQcq,CQPrivateMessageEventevent){Stringmessageevent.getMessage();if(message.contains(hello)){cq.sendPrivateMsg(event.getUserId(),你好很高兴见到你~,false);}returnMESSAGE_IGNORE;}}总结WiseRobot 是一个功能完善、易于扩展的机器人框架具有以下优势✅ 代码规范结构清晰✅ 插件机制灵活✅ 支持多种消息渠道✅ 敏感词过滤高效✅ WebSocket实时通信✅ 社区支持活跃如果你正在寻找一个可靠的机器人开发框架或者想学习Spring Boot实战项目WiseRobot 绝对值得一试项目地址: https://gitee.com/blps/wise-robot.git作者: WiseRobot Team许可证: MIT License 欢迎大家star、fork也欢迎在评论区交流技术问题后续我会持续更新更多功能和使用教程敬请期待~#Java #SpringBoot #机器人 #开源项目 #CoolQ #QQ机器人