<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Shiro 基于OneBot协议的QQ机器人开发框架]]></title><description><![CDATA[<h1>About</h1>
<p dir="auto">一个基于OneBot协议的Java机器人开发框架，支持 mirai-api-http</p>
<p dir="auto">仓库：<a href="https://github.com/MisakaTAT/Shiro" target="_blank" rel="noopener noreferrer nofollow ugc">https://github.com/MisakaTAT/Shiro</a></p>
<h1>QuickStart</h1>
<pre><code>&lt;!-- 导入Maven依赖 --&gt;
&lt;dependency&gt;
    &lt;groupId&gt;com.mikuac&lt;/groupId&gt;
    &lt;artifactId&gt;shiro&lt;/artifactId&gt;
    &lt;!-- 请使用最新版本 --&gt;
    &lt;version&gt;1.1.1&lt;/version&gt;
&lt;/dependency&gt;
</code></pre>
<pre><code># 修改application.yaml
server:
  port: 5555

shiro:
  # 全局限速器 (基于令牌桶算法)，无需该配置字段可删除，将使用默认值（默认禁用）
  limiter:
    enable: false
    permits-per-second: 1
  # Webscoket连接地址，无需该配置字段可删除，将使用默认值 "/ws/shiro"
  ws-config:
    ws-url: "/ws/shiro"
  # 插件列表 (顺序执行，如果前一个插件返回了MESSAGE_BLOCK，将不会执行后续插件)
  plugin-list:
    - com.mikuac.bot.plugins.ExamplePlugin
</code></pre>
<pre><code>// 继承BotPlugin开始编写插件
@Component
public class ExamplePlugin extends BotPlugin {

    @Override
    public int onPrivateMessage(@NotNull Bot bot, @NotNull PrivateMessageEvent event) {
        // 构建消息
        MsgUtils msgUtils = MsgUtils().builder().face(66).text("Hello, this is shiro demo.");
        // 发送私聊消息
        bot.sendPrivateMsg(event.getUserId(), msgUtils.build(), false);
        // 返回 MESSAGE_IGNORE 插件向下执行，返回 MESSAGE_BLOCK 则不执行下一个插件
        return MESSAGE_IGNORE;
    }

    @Override
    public int onGroupMessage(@NotNull Bot bot, @NotNull GroupMessageEvent event) {
        // 构建消息
        MsgUtils msgUtils = MsgUtils().builder().at(event.getUserId()).face(66).text("Hello, this is shiro demo.");
        // 发送群消息
        bot.sendGroupMsg(event.getGroupId(), msgUtils.build(), false);
        // 返回 MESSAGE_IGNORE 插件向下执行，返回 MESSAGE_BLOCK 则不执行下一个插件
        return MESSAGE_IGNORE;
    }

}
</code></pre>
]]></description><link>https://mirai.mamoe.net/topic/569/shiro-基于onebot协议的qq机器人开发框架</link><generator>RSS for Node</generator><lastBuildDate>Mon, 16 Mar 2026 11:11:47 GMT</lastBuildDate><atom:link href="https://mirai.mamoe.net/topic/569.rss" rel="self" type="application/rss+xml"/><pubDate>Thu, 26 Aug 2021 12:25:53 GMT</pubDate><ttl>60</ttl></channel></rss>