npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

koishi-plugin-bilirice

v0.0.9

Published

这是一个bilibili直播间事件监控插件

Readme

一款为 Koishi 框架开发的 B 站直播间监控插件,支持实时监听指定 UP 主的开播 / 下播状态,并自动发送通知到指定 QQ 群,同时提供下播数据统计、自定义通知模板等功能。 功能特性 • 🚨 实时监控:定时轮询 B 站直播 API,检测 UP 主开播 / 下播状态 • 📢 自动通知:开播 / 下播时自动发送消息到指定 QQ 群 • 📊 数据统计:下播时展示直播时长、最高在线人数、弹幕数等数据 • ✨ 自定义模板:支持自定义开播 / 下播通知的文案格式 • ⚙️ 灵活配置:可自定义轮询间隔、API 超时时间等参数 • 📝 手动指令:支持手动触发检查指定 UP 主的直播间状态 安装要求 • Koishi v4.x+ • Node.js 16.x+ • 已安装 OneBot 适配器(如 go-cqhttp)并配置好 QQ 机器人 安装步骤

  1. 安装依赖 在 Koishi 项目根目录执行: npm install axios
  2. 部署插件 将插件文件(bilirice.ts/bilirice.js)放入 Koishi 项目的 plugins 目录下。
  3. 启用插件 方式 1:配置文件(推荐) 编辑 koishi.config.js,添加插件配置: module.exports = { bots: [{ type: 'onebot:http', endpoint: 'http://127.0.0.1:5700', // go-cqhttp 地址 selfId: '123456789', // 你的 QQ 机器人账号 }], selfUrl: 'http://localhost:5140', // 解决控制台静态资源警告 plugins: { // 启用 bilirice 插件 bilirice: { // 必填:监听的主播列表 anchors: [ ['14663353', 'group_123456789'], // [UP主UID, 通知群号(OneBot格式)] // ['20206767', 'group_987654321,group_876543210'], // 多个群号用逗号分隔 ], // 可选配置(以下为默认值) pollInterval: 10, // 轮询间隔(秒) timeout: 5000, // API 请求超时时间(毫秒) // 可选:自定义通知模板 templates: { liveStart: '🎉 {uname} 开播啦!\n标题:{title}\n分区:{area}\n链接:{url}\n{cover}', liveEnd: '🛑 {uname} 下播啦!\n直播时长:{liveTime}\n最高在线:{peakOnline}人\n弹幕数:{dmCount}', }, }, // 可选:启用 Koishi 控制台 '@koishijs/plugin-console': { port: 5140 }, }, }; 方式 2:控制台可视化配置
  4. 启动 Koishi 后访问控制台(默认:http://localhost:5140)
  5. 进入「本地插件」→ 找到 bilirice 插件 → 点击「配置」
  6. 填写配置项后保存,重启插件即可 配置项说明 配置项 类型 必填 默认值 说明 anchors [string, string][] 是 - 监听的主播列表,格式:[UP主UID, 通知群号];多个群号用逗号分隔,OneBot 适配器群号需加 group_ 前缀(如 group_123456789)pollInterval number 否 10 直播间状态轮询间隔(秒),建议≥5 秒,避免频繁请求 API timeout number 否 5000 B站API请求超时时间(毫秒) templates.liveStart string 否 详见配置示例 开播通知模板,支持以下占位符:
  • {uname}:UP 主昵称
  • {title}:直播间标题
  • {area}:直播分区
  • {url}:直播间链接
  • {startTime}:开播时间
  • {cover}:直播间封面图片 templates.liveEnd string 否 详见配置示例 下播通知模板,除开播模板占位符外,还支持:
  • {liveTime}:直播时长(时:分: 秒)
  • {peakOnline}:最高在线人数
  • {watchCount}:观看人数
  • {dmCount}:弹幕数
  • {avgDmPerUser}:人均弹幕数
  • {medalCount}:舰队数
  • {endTime}:下播时间 使用方法
  1. 自动监控 插件启动后会自动初始化监听列表中的 UP 主,并按配置的轮询间隔检查状态,开播 / 下播时自动发送通知到指定群聊。
  2. 手动指令 在 QQ 群 / 私聊中发送指令,手动检查指定 UP 主的直播间状态: bilirice <UP主UID> 示例: bilirice 14663353 执行后会返回检查结果,并同步发送通知到当前群聊(仅群聊环境有效)。 通知示例 开播通知 🎉 老番茄 开播啦! 标题:【直播】玩点新游戏! 分区:游戏 - 单机游戏 链接:https://live.bilibili.com/123456 [图片:直播间封面] 下播通知 🛑 老番茄 下播啦! 直播时长:01:20:30 最高在线:12345人 观看人数:123456 弹幕数:65432 人均弹幕:0.53 注意事项
  3. 群号格式:使用 OneBot 适配器(如 go-cqhttp)时,群号必须加 group_ 前缀(如 group_123456789);其他适配器直接填写群号即可。
  4. API 限制:请勿将轮询间隔设置过小(<5 秒),避免触发 B 站 API 频率限制。
  5. 机器人权限:确保 QQ 机器人已加入目标群聊,且拥有发送消息、发送图片的权限。
  6. 隐私说明:插件仅用于个人 / 非商业用途,请勿滥用 B 站 API,遵守平台规范。
  7. 依赖检查:确保已安装 axios 依赖,否则插件会启动失败。 常见问题 Q1: 报错 $.anchors missing required value 原因:未配置必填项 anchors。解决:在配置文件中补充 anchors 配置,填写正确的 UP 主 UID 和群号。 Q2: 提示 未找到可用的Bot实例 原因:机器人未登录 / 适配器配置错误。解决:检查 bots 配置中的 selfId、endpoint 是否正确,确保 go-cqhttp 已正常运行并连接。 Q3: 插件启动但不发送通知 解决步骤:
  8. 检查群号格式是否正确(OneBot 需加 group_ 前缀);
  9. 确认机器人已加入目标群聊;
  10. 查看 Koishi 日志,检查是否有 API 请求失败的错误;
  11. 验证 UP 主 UID 是否正确,且当前是否在开播状态。 Q4: 控制台显示 assets missing config selfUrl 解决:在配置文件中添加 selfUrl: 'http://localhost:5140' 即可消除警告。 许可证 本插件基于 MIT 许可证开源,仅供学习和非商业使用。使用本插件需遵守 B 站平台规范,请勿用于违法违规场景。