All Projects → MisakaTAT → Shiro

MisakaTAT / Shiro

Licence: AGPL-3.0 license
基于OneBot协议的QQ机器人快速开发框架

Programming Languages

java
68154 projects - #9 most used programming language

Projects that are alternatives of or similar to Shiro

GreenOnions
一个Mirai的QQ机器人, 实现了搜图, RSS订阅转发, 根据PixivID下载原图, 翻译, setu等功能
Stars: ✭ 109 (+39.74%)
Mutual labels:  mirai-bot, qqbot, onebot, qqrobot, cqhttp
ProtobufBot
QQ机器人框架 ProtobufBot 整体介绍。看README
Stars: ✭ 45 (-42.31%)
Mutual labels:  qqbot, onebot, qqrobot, cqhttp
OlivOS
OlivOS / Witness Union
Stars: ✭ 48 (-38.46%)
Mutual labels:  onebot, cqhttp, onebot-sdk, qq-guild
OneBot-YaYa
✨ OneBot(原CQHTTP) 多平台的实现
Stars: ✭ 108 (+38.46%)
Mutual labels:  qqbot, onebot, qqrobot, cqhttp
Go-Mirai-Client
基于MiraiGo的客户端,使用反向 websocket 收发私聊、群聊消息,消息格式类似onebot。支持多账号,很稳定
Stars: ✭ 90 (+15.38%)
Mutual labels:  qq, qqbot, qqrobot, cqhttp
nonebot-plugin
一些 NoneBot 即开即用、良好兼容的插件——自定义表情包、早晚安、Vtuber今日运势等
Stars: ✭ 101 (+29.49%)
Mutual labels:  qq, qqbot, qqrobot, cqhttp
Coolq Http Api
为 酷Q 提供通过 HTTP 或 WebSocket 接收事件和调用 API 的能力
Stars: ✭ 1,787 (+2191.03%)
Mutual labels:  qq, qqbot, qqrobot, cqhttp
onebot
OneBot:统一的聊天机器人应用接口标准
Stars: ✭ 1,113 (+1326.92%)
Mutual labels:  qqbot, onebot, cqhttp
zhamao-framework
协程、高性能、灵活的聊天机器人 & Web 开发框架(炸毛框架)
Stars: ✭ 99 (+26.92%)
Mutual labels:  qqbot, onebot, cqhttp
ABot-Graia
一个使用 Graia Ariadne 搭建的 QQ 功能性机器人。
Stars: ✭ 194 (+148.72%)
Mutual labels:  mirai-bot, qq, qqbot
java
基于 go-cqhttp 和 java 的 qq 机器人
Stars: ✭ 128 (+64.1%)
Mutual labels:  qqbot, cqhttp, go-cqhttp
mirai-setu
一个mirai-console的简单的色图插件
Stars: ✭ 105 (+34.62%)
Mutual labels:  mirai-bot, qqbot, qqrobot
Mirai.Net
Mirai.Net是基于mirai-api-http实现的轻量级mirai社区sdk。
Stars: ✭ 132 (+69.23%)
Mutual labels:  mirai-bot, qq, qqbot
Sisters.WudiLib
C# 与 One Bot 协议实现通信。
Stars: ✭ 33 (-57.69%)
Mutual labels:  qq, qqbot, qqrobot
coolq-php-sdk
coolq-php-sdk
Stars: ✭ 23 (-70.51%)
Mutual labels:  qq, qqbot, cqhttp
py-pcqq
Python3模拟PCQQ客户端协议
Stars: ✭ 79 (+1.28%)
Mutual labels:  qq, qqbot, qqrobot
Mirai-Bot
Robot developed based on RICQ framework
Stars: ✭ 6 (-92.31%)
Mutual labels:  qq, qqbot
splatoon2-qqbot
主要用于 Splatoon2 群的机器人
Stars: ✭ 40 (-48.72%)
Mutual labels:  qqbot, cqhttp
mirai-class-notice
🥳 这是一款基于 mirai 的班级 QQ 群课程通知机器人,拥有简单的 web 管理页面,尽量实现一键安装简易操作等功能。
Stars: ✭ 25 (-67.95%)
Mutual labels:  mirai-bot, qqbot
SetuAPI
色图API
Stars: ✭ 39 (-50%)
Mutual labels:  qq, qqbot

Yuri

Shiro

基于 OneBot 协议的 QQ机器人 快速开发框架

maven issues license jdk-version qq-group

文档 · 下载 · 快速开始 · 参与贡献

Repobeats analytics image

QuickStart

依赖引入

引入依赖时请替换版本 latestMaven Central 实际的最新版本

Maven

<dependency>
  <groupId>com.mikuac</groupId>
  <artifactId>shiro</artifactId>
  <version>latest</version>
</dependency>

Gradle Kotlin DSL

implementation("com.mikuac:shiro:latest")

Gradle Groovy DSL

implementation 'com.mikuac:shiro:latest'

示例插件

注解调用

编写 application.yaml 配置文件 或参考 进阶配置文件

server:
  port: 5000
@Shiro
@Component
public class ExamplePlugin {

    // 符合 cmd 正则表达式的消息会被响应
    @PrivateMessageHandler(cmd = "hi")
    public void fun1(@NotNull Bot bot, @NotNull PrivateMessageEvent event, @NotNull Matcher matcher) {
        // 构建消息
        String sendMsg = MsgUtils.builder().face(66).text("Hello, this is shiro demo.").build();
        // 发送私聊消息
        bot.sendPrivateMsg(event.getUserId(), sendMsg, false);
    }

    // 如果 at 参数设定为 AtEnum.NEED 则只有 at 了机器人的消息会被响应
    @GroupMessageHandler(at = AtEnum.NEED)
    public void fun2(@NotNull GroupMessageEvent event) {
        // 以注解方式调用可以根据自己的需要来为方法设定参数
        // 例如群组消息可以传递 GroupMessageEvent, Bot, Matcher 多余的参数会被设定为 null
        System.out.println(event.getMessage());
    }

    // 同时监听群组及私聊消息 并根据消息类型(私聊,群聊)回复
    @MessageHandler
    public void fun3(@NotNull Bot bot, @NotNull AnyMessageEvent event) {
        bot.sendMsg(event, "hello", false);
    }

}

重写父类方法

  • 注解方式编写的插件无需在插件列表 plugin-list定义
  • 服务端配置文件 resources/application.yaml 追加如下内容
  • 插件列表为顺序执行,如果前一个插件返回了 MESSAGE_BLOCK 将不会执行后续插件

编写 application.yaml 配置文件 或参考 进阶配置文件

server:
  port: 5000
shiro:
  plugin-list:
    - com.example.bot.plugins.ExamplePlugin
@Component
public class ExamplePlugin extends BotPlugin {

    @Override
    public int onPrivateMessage(@NotNull Bot bot, @NotNull PrivateMessageEvent event) {
        if ("hi".equals(event.getMessage())) {
            // 构建消息
            String sendMsg = MsgUtils.builder()
                    .face(66)
                    .text("hello, this is shiro example plugin.")
                    .build();
            // 发送私聊消息
            bot.sendPrivateMsg(event.getUserId(), sendMsg, false);
        }
        // 返回 MESSAGE_IGNORE 执行 plugin-list 下一个插件,返回 MESSAGE_BLOCK 则不执行下一个插件
        return MESSAGE_IGNORE;
    }

    @Override
    public int onGroupMessage(@NotNull Bot bot, @NotNull GroupMessageEvent event) {
        if ("hi".equals(event.getMessage())) {
            // 构建消息
            String sendMsg = MsgUtils.builder()
                    .at(event.getUserId())
                    .face(66)
                    .text("hello, this is shiro example plugin.")
                    .build();
            // 发送群消息
            bot.sendGroupMsg(event.getGroupId(), sendMsg, false);
        }
        // 返回 MESSAGE_IGNORE 执行 plugin-list 下一个插件,返回 MESSAGE_BLOCK 则不执行下一个插件
        return MESSAGE_IGNORE;
    }

}

Client

Shiro 以 OneBot-v11 标准协议进行开发,兼容所有支持反向WebSocket的OneBot协议客户端

项目地址 平台 核心作者 备注
Yiwen-Chan/OneBot-YaYa 先驱 kanri
richardchien/coolq-http-api CKYU richardchien 可在 Mirai 平台使用 mirai-native 加载
Mrs4s/go-cqhttp MiraiGo Mrs4s
yyuueexxiinngg/OneBot-Mirai Mirai yyuueexxiinngg
takayama-lily/onebot OICQ takayama

Contributors

contributors

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

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].