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

@zhin.js/plugin-stats

v0.0.0

Published

Message statistics plugin for Zhin.js — track per-user and per-group message counts with daily/weekly reports

Downloads

95

Readme

@zhin.js/plugin-stats

消息统计插件 —— 按用户/群维度统计消息量,支持日/周/月报表和活跃排行。

安装

npm install @zhin.js/plugin-stats

配置

zhin.config.yml 中添加:

plugins:
  - "@zhin.js/plugin-stats"
stats:
  rankSize: 10         # 排行榜显示人数(默认 10)
  retentionDays: 90    # 数据保留天数(默认 90)

命令

| 命令 | 说明 | |------|------| | stats | 查看今日消息统计 | | stats-week | 查看本周消息统计 | | stats-rank | 查看本月话唠排行 | | mystats | 查看个人消息统计 |

工作原理

  1. 中间件自动计数,不干扰消息处理流程
  2. 使用写入缓冲(10s 批量刷盘),减少数据库 IO
  3. (用户ID, 群ID, 日期) 维度存储每日计数
  4. 自动清理超过保留天数的旧数据

AI 工具

| 工具名 | 说明 | |--------|------| | stats_query | 查询消息统计数据(支持 today/week/month) | | stats_user | 查询指定用户的消息统计 |

数据库

依赖 Zhin 数据库服务,自动创建 message_stats 表:

| 字段 | 类型 | 说明 | |------|------|------| | user_id | text | 用户 ID | | user_name | text | 用户名 | | group_id | text | 群 ID(私聊为空) | | date | text | 日期 (YYYY-MM-DD) | | count | integer | 当日消息数 |

许可

MIT