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

v0.0.1

Published

异环社区工具箱 - 前瞻兑换码等

Readme

koishi-plugin-yihuan

koishi

English

一个 Koishi 插件,为异环服务 —— 自动从官方社区获取前瞻直播兑换码,通过 OCR 识别后分发到配置的群聊。


功能

  • 监控塔吉多社区异环官方账号的前瞻帖子
  • 下载并预处理兑换码图片,通过 PaddleOCR (PP-OCRv4) 提取文本
  • 缓存 OCR 结果,避免重复计算
  • 三种触发方式 —— 指令、关键词检测、定时推送

指令

| 指令 | 说明 | |:-----|:-----| | yh.code | 回复最新的兑换码图片 + 识别文本 | | yh.push | 将最新兑换码推送到所有配置目标(仅新帖子时推送) |

关键词触发

消息中包含 "异环兑换码" 时自动回复(每个群每小时限一次)。

配置项

| 字段 | 类型 | 默认值 | 说明 | |:-----|:-----|:-------|:-----| | enabled | boolean | true | 主开关 | | pushTargets | array | [] | 推送目标 —— { platform, channelId } | | checkHour | number | 21 | 定时检查时间(小时,0–23) | | checkMinute | number | 0 | 定时检查时间(分钟,0–59) | | cooldownSeconds | number | 600 | yh.code 群聊冷却时间(秒) |

工作流程

塔吉多 BBS API  →  帖子过滤(前瞻特别节目,7 天内)
        │
        ▼
HTML 解析  →  提取"兑换码"后的 <img> 地址
        │
        ▼
图片处理  →  下载 → 缩放 → JPEG 压缩
        │
        ▼
OCR 识别  →  灰度化 → 归一化 → 锐化
        │            └→ PaddleOCR (Python)
        ▼
后处理  →  正则过滤 [A-Z0-9]{8,20}
        │            └→ 去重 → 最多保留 3 个
        ▼
缓存 (redeem-code.json)  →  回复 / 推送

安装

在 Koishi 控制台中搜索 yihuan 并点击安装。

或在 Koishi 项目目录中通过命令行:

npm install koishi-plugin-yihuan

前置条件

  • Koishi >= 4.18.7
  • Python 3 + PaddleOCR(pip install paddleocr paddlepaddle

许可证

MIT