Skip to content

Repository files navigation

OneBot Client

✨ 基于java开发的 OneBot 协议客户端✨


issuesLicense

文档 | QuickStart

QuickStart

使用api进行请求

publicclassWebSocketClientTest {
publicstaticOneBotClientonebot;
publicstaticvoidsendApi(String[] args) {
onebot = OneBotClient.create(newBotConfig("ws://127.0.0.1:8080"))//创建websocket客户端
.open()//连接onebot服务端
.registerEvents(newEventListeners());//注册事件监听器onebot.getBot().sendGroupMsg(123456, MsgUtils.builder().text("123").build(), true);//发送群消息GroupMemberInfoRespsender = onebot.getBot().getGroupMemberInfo(123456, 123456, false).getData();//获取响应的群成员信息System.out.println(sender.toString());//打印
}
}

事件监听示例

publicclassEventListenersimplementsListener{
@SubscribeEventpublicvoidonGroup(GroupMessageEventevent){
System.out.println(event);
}
}
publicclassWebSocketClientTest {
publicstaticOneBotClientonebot;
publicstaticvoidmain(String[] args){
onebot = OneBotClient.create(newBotConfig("ws://127.0.0.1:8080"))//创建websocket客户端
.open()//连接onebot服务端
.registerEvents(newEventListeners());//注册事件监听器
}
publicstaticvoidstopped() {
if (onebot != null) onebot.close();
}
}

Client

OneBot-Client 以 OneBot-v11 标准协议进行开发,兼容所有支持正向WebSocket的OneBot协议端

项目地址核心作者备注
OverflowMrXiaoM实现 mirai 的无缝迁移
Lagrange.CoreNepPureC#实现 By Konata.Core
OpenShamrockwhitechi73Xposed框架hook实现
GensokyoHoshinonyaruko基于官方api 轻量 原生跨平台
LLOnebotlinyuchen使用LiteLoaderQQNT

Credits

License

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

Thanks JetBrains Provide Free License Support OpenSource Project

Stargazers over time

Stargazers over time

About

基于java开发的onebot协议客户端

Topics

Resources

Stars

54 stars

Watchers

1 watching

Forks

Releases

Used by

Contributors

Languages