{"id":24308844,"url":"https://github.com/ouhaochen1024/xbot","last_synced_at":"2026-05-06T14:34:15.608Z","repository":{"id":271081508,"uuid":"911553217","full_name":"ouhaochen1024/XBot","owner":"ouhaochen1024","description":"基于Shiro框架开发的QQ机器人服务端","archived":false,"fork":false,"pushed_at":"2025-02-26T11:16:06.000Z","size":308,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-06T20:17:08.792Z","etag":null,"topics":["chatbot","java","kotlin-dsl","onebot","postgresql","qq","qqbot","shiro","springboot"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ouhaochen1024.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2025-01-03T09:38:18.000Z","updated_at":"2025-02-25T12:51:35.000Z","dependencies_parsed_at":"2025-01-06T09:29:20.802Z","dependency_job_id":"0b09d144-c4d0-48a2-a8d3-23166bc314d4","html_url":"https://github.com/ouhaochen1024/XBot","commit_stats":null,"previous_names":["ouhaochen2048/x-bot","ouhaochen1024/x-bot","ouhaochen1024/xbot"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ouhaochen1024%2FXBot","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ouhaochen1024%2FXBot/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ouhaochen1024%2FXBot/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ouhaochen1024%2FXBot/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ouhaochen1024","download_url":"https://codeload.github.com/ouhaochen1024/XBot/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":242277696,"owners_count":20101545,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["chatbot","java","kotlin-dsl","onebot","postgresql","qq","qqbot","shiro","springboot"],"created_at":"2025-01-17T05:11:44.324Z","updated_at":"2026-05-06T14:34:15.575Z","avatar_url":"https://github.com/ouhaochen1024.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# XBot\n\n基于 [Shiro](https://github.com/MisakaTAT/Shiro) 框架的QQ机器人服务端  查阅 [Shiro文档](https://misakatat.github.io/shiro-docs/advanced.html)\n\n\u003cp style=\"text-align: center;\"\u003e\n    \u003ca href=\"https://github.com/MisakaTAT/Shiro\"\u003e\u003cimg alt=\"Shiro\" src=\"https://img.shields.io/badge/Shiro-2.3.5-yellow.svg\" /\u003e\u003c/a\u003e\n    \u003ca href=\"https://openjdk.org/projects/jdk/\"\u003e\u003cimg alt=\"JDK\" src=\"https://img.shields.io/badge/JDK-17+-red.svg\" /\u003e\u003c/a\u003e\n    \u003ca href=\"https://spring.io/projects/spring-boot\"\u003e \u003cimg alt=\"SpringBoot\" src=\"https://img.shields.io/badge/SpringBoot-3.0.0+-brightgreen.svg\" /\u003e\u003c/a\u003e\n    \u003ca href=\"https://www.postgresql.org/\"\u003e\u003cimg alt=\"PostgreSQL\" src=\"https://img.shields.io/badge/PostgreSQL-15+-blue.svg\" /\u003e\u003c/a\u003e\n    \u003ca href=\"https://gradle.org/\"\u003e\u003cimg alt=\"PostgreSQL\" src=\"https://img.shields.io/badge/Gradle-8.0+-22afc8\" /\u003e\u003c/a\u003e\n    \u003ca href=\"https://redis.io/\"\u003e\u003cimg alt=\"Redis\" src=\"https://img.shields.io/badge/Redis-7.0+-ff4438\" /\u003e\u003c/a\u003e\n\u003c/p\u003e  \n\n机器人客户端推荐使用 [NapCat](https://github.com/NapNeko/NapCatQQ)\n\n已经实现的功能（插件）：\n\n系统插件（SystemPlugin）：\n\n1.插件状态管理（管理自身无效）\n\n|           命令           | 使用范围  |           说明           |   示例命令    |\n| :----------------------: |:-----:|:----------------------:| :-----------: |\n| 查看插件状态 或 插件状态 | 群聊/私聊 |      查看当前机器人插件状态       |   插件状态    |\n|     启用插件 或 启用     | 群聊/私聊 |     启用当前机器人某个插件状态      | 启用 群聊管理 |\n|     禁用插件 或 禁用     | 群聊/私聊 |     禁用当前机器人某个插件状态      | 禁用 群聊管理 |\n\n2.插件权限管理（是否为机器人的管理者、QQ群是否有权限使用机器人）\n\n|           命令           | 使用范围  |         说明         |   示例命令    |\n| :----------------------: |:-----:| :------------------: | :-----------: |\n| 添加本群权限 或 添加本群 | 对应群聊  | 添加当前对话群的权限 |   添加本群    |\n| 删除本群权限 或 删除本群 | 对应群聊  | 删除当前对话群的权限 |   删除本群    |\n|          添加群          | 群聊/私聊 |  添加对应群号的权限  | 添加群 114514 |\n|          删除群          | 群聊/私聊 |  删除对应群号的权限  | 删除群 114514 |\n\n目前在开发的功能（插件）：\n\n群聊管理 （GroupManagePlugin）\n\n后续预计新增的功能（插件）：\n=======\n目前在开发的插件：\n\nGroupManagePlugin（QQ群管理插件）\n\n后续预计新增的插件：\n\n天气查询\n\n签到\n\n互动小游戏\n\n个人插件：\n\n阴阳师订阅（默认订阅阴阳师大神官号 后期加入对弈竞猜相关）\n\n## 示例插件\n\n### 注解调用\n\n\u003e 编写 `application.yaml` 配置文件\n\u003e 或参考 [进阶配置文件](https://misakatat.github.io/shiro-docs/advanced.html#进阶配置文件)\n\n```yaml\nserver:\n  port: 5000\n```\n\n```java\n\n@Shiro\n@Component\npublic class ExamplePlugin {\n    // 更多用法详见 @MessageHandlerFilter 注解源码\n\n    // 当机器人收到的私聊消息消息符合 cmd 值 \"hi\" 时，这个方法会被调用。\n    @PrivateMessageHandler\n    @MessageHandlerFilter(cmd = \"hi\")\n    public void fun1(Bot bot, PrivateMessageEvent event, Matcher matcher) {\n        // 构建消息\n        String sendMsg = MsgUtils.builder().face(66).text(\"Hello, this is shiro demo.\").build();\n        // 发送私聊消息\n        bot.sendPrivateMsg(event.getUserId(), sendMsg, false);\n    }\n\n    // 如果 at 参数设定为 AtEnum.NEED 则只有 at 了机器人的消息会被响应\n    @GroupMessageHandler\n    @MessageHandlerFilter(at = AtEnum.NEED)\n    public void fun2(GroupMessageEvent event) {\n        // 以注解方式调用可以根据自己的需要来为方法设定参数\n        // 例如群组消息可以传递 GroupMessageEvent, Bot, Matcher 多余的参数会被设定为 null\n        System.out.println(event.getMessage());\n    }\n\n    // 同时监听群组及私聊消息 并根据消息类型（私聊，群聊）回复\n    @AnyMessageHandler\n    @MessageHandlerFilter(cmd = \"say hello\")\n    public void fun3(Bot bot, AnyMessageEvent event) {\n        bot.sendMsg(event, \"hello\", false);\n    }\n}\n```\n\n### 重写父类方法\n\n- 注解方式编写的插件无需在插件列表 `plugin-list`定义\n- 服务端配置文件 `resources/application.yaml` 追加如下内容\n- 插件列表为顺序执行，如果前一个插件返回了 `MESSAGE_BLOCK` 将不会执行后续插件\n\n\u003e 编写 `application.yaml` 配置文件\n\u003e 或参考 [进阶配置文件](https://misakatat.github.io/shiro-docs/advanced.html#进阶配置文件)\n\n```yaml\nserver:\n  port: 5000\nshiro:\n  plugin-list:\n    - com.example.bot.plugins.ExamplePlugin\n```\n\n```java\n\n@Component\npublic class ExamplePlugin extends BotPlugin {\n\n    @Override\n    public int onPrivateMessage(Bot bot, PrivateMessageEvent event) {\n        if (\"hi\".equals(event.getMessage())) {\n            // 构建消息\n            String sendMsg = MsgUtils.builder()\n                    .face(66)\n                    .text(\"hello, this is shiro example plugin.\")\n                    .build();\n            // 发送私聊消息\n            bot.sendPrivateMsg(event.getUserId(), sendMsg, false);\n        }\n        // 返回 MESSAGE_IGNORE 执行 plugin-list 下一个插件，返回 MESSAGE_BLOCK 则不执行下一个插件\n        return MESSAGE_IGNORE;\n    }\n\n    @Override\n    public int onGroupMessage(Bot bot, GroupMessageEvent event) {\n        if (\"hi\".equals(event.getMessage())) {\n            // 构建消息\n            String sendMsg = MsgUtils.builder()\n                    .at(event.getUserId())\n                    .face(66)\n                    .text(\"hello, this is shiro example plugin.\")\n                    .build();\n            // 发送群消息\n            bot.sendGroupMsg(event.getGroupId(), sendMsg, false);\n        }\n        // 返回 MESSAGE_IGNORE 执行 plugin-list 下一个插件，返回 MESSAGE_BLOCK 则不执行下一个插件\n        return MESSAGE_IGNORE;\n    }\n\n}\n```\n# Client\n\n[Shiro](https://github.com/MisakaTAT/Shiro) 以 [OneBot-v11](https://github.com/howmanybots/onebot/tree/master/v11/specs)标准协议进行开发，兼容所有支持反向WebSocket的OneBot协议客户端\n\n| 项目                                                        | 描述                                             | 备注 |\n| ----------------------------------------------------------- | ------------------------------------------------ | ---- |\n| [NapCat](https://github.com/NapNeko/NapCatQQ)               | NapCatQQ 是现代化的基于 NTQQ 的 Bot 协议端实现   | 推荐 |\n| [LLOneBot](https://github.com/LLOneBot/LLOneBot)            | 使你的 NTQQ 支持 OneBot11 协议进行 QQ 机器人开发 |      |\n| [Lagrange.Core](https://github.com/KonataDev/Lagrange.Core) | NTQQ 的协议实现                                  |      |\n| [OpenShamrock](https://github.com/whitechi73/OpenShamrock)  | 基于 Xposed 实现 OneBot 标准的机器人框架         |      |\n\n# License\n\nThis product is licensed under the GNU General Public License version 3. The license is as published by the Free\nSoftware Foundation published at https://www.gnu.org/licenses/gpl-3.0.html.\n\nAlternatively, this product is licensed under the GNU Lesser General Public License version 3 for non-commercial use.\nThe license is as published by the Free Software Foundation published at https://www.gnu.org/licenses/lgpl-3.0.html.\n\nFeel free to contact us if you have any questions about licensing or want to use the library in a commercial closed\nsource product.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fouhaochen1024%2Fxbot","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fouhaochen1024%2Fxbot","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fouhaochen1024%2Fxbot/lists"}