McBot
A mod allowed you to connect minecraft and QQ
Install / Use
/learn @Nova-Committee/McBotREADME
McBot
✨ 基于 OneBot 协议的 我的世界 QQ机器人✨
</div> <hr> <p align="center"> <a href="https://github.com/Nova-Committee/McBot/issues"><img src="https://img.shields.io/github/issues/Nova-Committee/McBot?style=flat" alt="issues" /></a> <a href="https://www.curseforge.com/minecraft/mc-mods/botconnect"> <img src="http://cf.way2muchnoise.eu/botconnect.svg" alt="CurseForge Download"> </a> <img src="https://img.shields.io/badge/license-GPLV3-green" alt="License"> <a href="https://github.com/howmanybots/onebot"><img src="https://img.shields.io/badge/OneBot-v11-blue?style=flat&logo=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABABAMAAABYR2ztAAAAIVBMVEUAAAAAAAADAwMHBwceHh4UFBQNDQ0ZGRkoKCgvLy8iIiLWSdWYAAAAAXRSTlMAQObYZgAAAQVJREFUSMftlM0RgjAQhV+0ATYK6i1Xb+iMd0qgBEqgBEuwBOxU2QDKsjvojQPvkJ/ZL5sXkgWrFirK4MibYUdE3OR2nEpuKz1/q8CdNxNQgthZCXYVLjyoDQftaKuniHHWRnPh2GCUetR2/9HsMAXyUT4/3UHwtQT2AggSCGKeSAsFnxBIOuAggdh3AKTL7pDuCyABcMb0aQP7aM4AnAbc/wHwA5D2wDHTTe56gIIOUA/4YYV2e1sg713PXdZJAuncdZMAGkAukU9OAn40O849+0ornPwT93rphWF0mgAbauUrEOthlX8Zu7P5A6kZyKCJy75hhw1Mgr9RAUvX7A3csGqZegEdniCx30c3agAAAABJRU5ErkJggg=="></a> <a href="https://github.com/Nova-Committee/McBot/actions/workflows/fabric.yml"><img src="https://github.com/Nova-Committee/McBot/actions/workflows/fabric.yml/badge.svg"></a> </p> <p align="center"> <a href="README_EN.md">English</a> | <a href="https://github.com/Nova-Committee/McBot#%E9%95%BF%E6%9C%9F%E6%94%AF%E6%8C%81%E7%89%88%E6%9C%AC">长期支持版本</a> | <a href="https://github.com/Nova-Committee/McBot#%E5%BF%AB%E9%80%9F%E5%BC%80%E5%A7%8B">快速开始</a> </p>长期支持版本
Forge 1.16.5/1.18.2/1.19.2/1.20.1/1.21
Fabric 1.16.5/1.18.2/1.19.2/1.20.1/1.21
快速开始
使用api进行请求
public class APIDemo {
static {
// 事件回调
McBotEvents.ON_CHAT.register((player, msgId, msg) -> System.out.printf("McBot刚刚转发一条消息。由%s发送了%s (%s)%n", player.getName().getString(), msg, msgId));
}
/**
* 群里发送消息
* @param groupId 群号
* @param message 消息
*/
public static void doSend(long groupId, String message) throws CommandSyntaxException {
Const.sendGroupMsg(groupId, message)
}
/**
* 撤回消息
* @param message_id 消息ID
*/
public static void recallMessage(int message_id) {
JsonObject json = new Gson().fromJson(
String.format("{'message_id': %s}", message_id),
JsonObject.class);
Const.customRequest(ActionType.DELETE_MSG, json);
}
}
事件监听示例
public class WebSocketServerTest {
public static void main(String[] args) throws Exception {
public static LinkedBlockingQueue<String> blockingQueue = new LinkedBlockingQueue<>();//使用队列传输数据
public static Thread app = new Thread(() -> {
service = new ConnectFactory(new BotConfig(), blockingQueue);//创建websocket连接
bot = service.ws.createBot();//创建机器人实例
}, "BotServer");
app.start();
EventBus bus = new EventBus(blockingQueue);//创建事件分发器
GroupMessageListener groupMessageListener = new GroupMessageListener();
groupMessageListener.addHandler("天气", new Handler<GroupMessageEvent>() {
@Override
public void handle(GroupMessageEvent groupMessage) {
System.out.println(groupMessage);
}
});
bus.addListener(groupMessageListener);//加入监听
bus.addListener(new SimpleListener<PrivateMessageEvent>() {//私聊监听
@Override
public void onMessage(PrivateMessageEvent privateMessage) {
System.out.println(privateMessage);
}
});
}
}
支持
McBot 以 OneBot-v11 标准协议进行开发,兼容所有支持正向WebSocket的OneBot协议端 | 项目地址 | 核心作者 | 备注 | |-----------------------------------------------------------------------------------|----------------|-----------------------------------------------------------------------| | Overflow | MrXiaoM | 实现 mirai 的无缝迁移 | | Lagrange.Core | NepPure | C#实现 By Konata.Core | | OpenShamrock | whitechi73 | Xposed框架hook实现 | | Gensokyo | Hoshinonyaruko | 基于官方api 轻量 原生跨平台 | | LLOnebot | linyuchen | 使用LiteLoaderQQNT | | NapCatQQ | MliKiowa | 基于NTQQ的无头Bot框架 | | OneBot-Mirai | cnlimiter | Mirai的onebot协议实现 |
Credits
开源许可
This product is licensed under the GNU General Public License version 3. The license is as published by the Free Software Foundation published at https://www.gnu.org/licenses/gpl-3.0.html.
Alternatively, this product is licensed under the GNU Lesser General Public License version 3 for non-commercial use. The license is as published by the Free Software Foundation published at https://www.gnu.org/licenses/lgpl-3.0.html.
Feel free to contact us if you have any questions about licensing or want to use the library in a commercial closed source product.
致谢
Thanks to JetBrains for allocating free open-source licences for IDEs such as IntelliJ IDEA <img src=".github/jetbrains-variant-3.png" width="200"/>
星星(要要)~⭐
Related Skills
node-connect
339.5kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
83.9kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
339.5kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
commit-push-pr
83.9kCommit, push, and open a PR
