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-jx3rollpig

v1.0.2

Published

今天是什么小猪:每日抽猪、EX 成长、图鉴与烤群友

Readme

koishi-plugin-jx3rollpig

「今天是什么小猪」的 Koishi 移植版,来源为 NoneBot 插件 Felis2026/nonebot-plugin-rollpig-plus (该项目又基于 Bearlele/nonebot-plugin-rollpig)。

每人每天抽一只小猪,重复抽同一只会提升 EX 专家等级,可以互相「烤群友」,并生成图片版图鉴。

指令

| 指令 | 别名 | 说明 | | --- | --- | --- | | 今日小猪 | 今天是什么小猪 | 抽今天的小猪,每人每天一次,重复查看不改变结果 | | 明日小猪 | | 随机运势文案 | | 昨日小猪 | | 回看昨天抽到的小猪 | | 今日烤猪 | | 把自己今天的猪做成熟食;没抽过会先补抽一只 | | 烤群友 @目标 | 见下方后门口令 | 成功 60% / 逃脱 30% / 反噬 10%,消耗充能 | | 随机烤群友 | 随机烤猪抽个群友烤了 | 从今天在本群抽过猪的人里随机挑一个 | | 我的猪圈 | 我的小猪 | 文本版收集摘要 | | 小猪图鉴 | 猪猪图鉴完整图鉴 | 图片版图鉴,一张图陈列全部 165 只,未解锁的显示为灰度剪影 |

指定目标

烤群友 的目标参数用 Koishi 内置的 user 域([target:user]),它把 <at> 转成 platform:openid。 支持这些写法:

烤群友 @某人
烤群友 @某人 加急生火      口令写在 @ 后面
加急生火 @某人             口令本身就是别名
回复某人的消息 + 烤群友     从 session.quote 取目标
烤群友 @机器人             触发 Bot 专属反噬,不消耗充能

口令写在 @ 前面烤群友 加急生火 @某人)会在参数解析阶段就失败, 因为 加急生火 会被当成 target 去解析。所有口令都注册成了别名,直接用上面第三种写法即可。

后门口令

  • 加急生火 / 加急生活 / 打点后厨 / 偷换烤架 / 贿赂主厨 — 强制成功, 每人每天 forceDailyLimit 次,可突破保护协议。
  • 强行点火 — 仅 authority >= 5 可用,无次数限制、不消耗充能。

两者都不会绕过目标的资格检查(目标必须已抽猪,且不能是人类 / 熟食 / 吃掉了 / 售罄形态)。

规则要点

  • EX 等级等级 = 累计抽取次数 - 1,钳制在 0~5。
  • 保底:每连续抽到一次重复猪,未解锁小猪的权重 +0.5,封顶 +4.0;抽到新猪后清零。
  • 业务日期:固定 UTC+8,零点跨天。
  • 烧烤充能:token bucket,每 roastCooldownHours 小时恢复 1 格,最多存 roastChargeMax 格;新用户默认满格。
  • 保护协议:前一天在本群被成功烤中最多、且不少于 2 次的人,次日免烤。上游靠每日总结定时任务写名单,这里改为查询时从烧烤日志按需推导,因此不需要额外的 cron。

配置

| 配置项 | 默认值 | 说明 | | --- | --- | --- | | imageBaseUrl | COS koishi-static/rollpig | 小猪图片根路径,按 <根路径>/<小猪id>.png 取图 | | roastCooldownHours | 8 | 每恢复 1 次烧烤充能所需小时数 | | roastChargeMax | 2 | 烧烤充能上限(1~6) | | forceDailyLimit | 1 | 加急点火口令每人每天可用次数 |

资源

165 只小猪的图片不入库,需要以 <小猪id>.png 上传到 imageBaseUrl 指向的对象存储。 小猪的元数据(id / 名称 / 描述 / 分析文案)与特殊形态规则在 src/data/pigs.ts, 文案池在 src/texts.ts,两者都是从上游 Python 源程序化转换而来。

新增小猪的步骤:往 PIGS 追加一条,并把同名图片传到对象存储。

渲染

图片走 ctx.jx3render(Puppeteer + Handlebars),模板在 external/jx3render/templates/RollpigCard.hbsRollpigCatalog.hbs, 遵循 .agent/rules/DESIGN_NEW.md 的黏土拟态规范。

图鉴不分页,165 只固定按资源顺序排在 10 列网格里——同一只猪永远在同一个格子, 才能一眼看出还缺哪几只。代价是成图约 1400×3300,属于长图。 新增小猪会让它继续变高:每多 10 只增加一行(约 150px)。

两个模板都给 html 显式设了背景色。这是必需的:body 的背景默认会传播到画布并按视口 (生产配置为 720px)而非 body 自身宽度解析渐变,整页截图会在视口宽度处出现竖向接缝。

与上游的差异

  • 不含:AI 烤猪(DeepSeek)、共享文案库、PigHub 搜猪 / 随机小猪、本周小猪长图、每日总结推送、 云端资源同步与多私有 overlay、EX 等级差分资源。烧烤正文使用上游的本地兜底模板。
  • 存储:上游是本地 JSON / rollpig-cloud,这里直接用仓库的 PostgreSQL。
  • 昵称与身份:QQ 官方机器人下发的是 openid 而非 QQ 号,且没有群成员列表接口。 因此「随机烤群友」只能从 rollpig_seen(今天在本群抽过猪的人)里挑目标, 被 @ 的人如果没在本群抽过猪,展示名会退回 openid。
  • GIF:上游支持动图小猪卡片,这里是 Puppeteer 截图,只能静态展示。

测试

yarn tsx external/jx3rollpig/test/rollpig.test.ts