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-komnai-stats

v0.5.9

Published

KuNET/BEMAPI 音游客流统计:全服游玩次数与固定机台分钟级客流、中文图表与每日简报

Readme

koishi-plugin-komnai-stats

基于 KuNET(BEMAPI)的音游客流统计插件,用于 Koishi QQ 机器人。

  • 全服统计:按 profile.plays 增量统计 KuNET 全网各游戏(SDVX / jubeat / REFLEC BEAT / pop'n music)的游玩次数。
  • 固定机台统计(0.5.x):按 PCBID 直查指定机台的 machine_status,落库为分钟桶,支持今日/昨日/时段图/趋势图;按机台独立计数——某台机器离线或缺桶只影响它自己,不拖累其他机台。
  • 每日自动简报(autoReport):每天北京时间 00:00 自动把上一自然日固定机台组的游玩简报发送到配置的群/私聊。
  • 免 @ 触发 + 中文图表:支持「音游窝客流」「星音库客流」「发送昨日简报」等中文别名直接触发;图表由 @napi-rs/canvas 渲染,自动匹配系统中文字体。

统计口径

  • 一局 = 一次投币游玩(通常含 3 首歌),不是单曲次数。单位统一为「局」。
  • 固定机台:采集器每 intervalMinutes 分钟轮询 recent_30_minutes.trend,按「截断分钟 + 机台」去重写入 komnai_arcade_bucket。
  • 简报/客流口径:每台机器只统计自己 complete !== false 的分钟,去重后累加;某台机器缺桶不会丢弃其他机台的计数。

安装

# 方式一:Koishi 插件市场搜索 koishi-plugin-komnai-stats 安装
# 方式二:npm
npm install koishi-plugin-komnai-stats
# 方式三:离线 tgz
npm install koishi-plugin-komnai-stats-0.5.9.tgz

配置

插件配置项(Koishi 控制台 / koishi.yml):

| 字段 | 说明 | | --- | --- | | baseUrl | BEMAPI 基础地址,默认 http://api.komnai.fun | | token | KuNET 只读 API Token(secret) | | intervalMinutes | 自动采集间隔(分钟),默认 5 | | scopeMode | server=全服采集;machine=只采固定机台(联调中) | | arcades | 固定机台组:key/label/machines(每台含 key、label、game、pcbid) | | autoReport | 是否每天 00:00 自动发送昨日简报 | | reportTargets | 简报发送目标(group/private + targetId + selfId) | | gameStatuses | 各游戏数据可信状态与提示 |

指令

komnai.today / 今日游玩次数            全服今日
komnai.yesterday / 昨日游玩统计        昨日简报(全服口径,未配置固定机台组时)
komnai.report / 发送昨日简报           手动向配置目标发送昨日简报
komnai.arcade-today / 音游窝客流       固定机台组今日客流(按机台分行)
komnai.arcade-yesterday / 音游窝昨日客流
komnai.arcade-hours / 音游窝时段客流    今日 24 小时时段图
komnai.arcade-trend / 音游窝客流趋势    近 N 天趋势图
(星音库* 为同一组机的别名)

数据

  • komnai_arcade_bucket:固定机台分钟桶(retainDays 默认 90 天清理)。
  • komnai_scope_sample / komnai_scope_state:全服采样与基线(全服口径使用)。
  • komnai_play_state:全服游戏级状态(旧版迁移)。

更新记录

  • 0.5.9:发送昨日简报权限降为普通可用。
  • 0.5.8:采集 key 改用截断分钟去重;一次性清理历史重复行;覆盖率警告改相对口径。
  • 0.5.7:按机台独立计数,pop'n 缺失不再丢弃整分钟;今日/昨日按机台分行;单位统一为「局」。
  • 0.5.6:简报改用固定机台口径(与音游窝客流同源);覆盖分钟提示。
  • 0.5.5:移除调试用监听器触发(原生命令可正常免 @ 触发)。
  • 0.5.4:中文图表字体(CJK OTF 注册)、时段图标签布局、星音库* 别名。
  • 0.5.3:修复缺台分钟仍判定完整的问题并补单元测试。

安全提示

  • 请使用只读 Token;Token、PCBID 属于敏感信息,勿在公共场合回显。
  • 插件不会在日志或指令输出中回显 Token / 完整 PCBID。

License

MIT