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-hoyolab-notifier

v1.0.7

Published

Hoyolab Notifier Plugin for Koishi

Readme

📱 koishi-plugin-hoyolab-notifier

npm downloads license

🎮 插件简介

koishi-plugin-hoyolab-notifier 是一个为 Koishi 机器人框架设计的米游社文章监控与通知插件。它能够监控指定米游社用户的文章更新,并在有新文章发布时,通过群聊及时通知订阅者,支持自定义标题过滤和用户昵称显示。

✨ 功能特性

  • 📢 自动监控:定时检查米游社用户发布的新文章
  • 🔔 群聊通知:在订阅者所在的群聊中发送通知消息
  • 👤 用户昵称:自动获取并显示米游社用户的昵称,而非仅显示 UID
  • 🔍 标题过滤:支持通过正则表达式过滤特定标题的文章
  • 📋 多群支持:同一用户可以在不同群聊中独立订阅不同的米游社用户
  • 📱 内容解析:支持解析文章中的图片和视频内容
  • 🎬 视频处理:智能判断视频时长,长视频显示链接,短视频直接嵌入
  • 🗄️ 数据持久化:使用 Koishi 数据库系统存储订阅信息和已发送文章记录

📋 命令列表

| 命令 | 说明 | 权限要求 | |------------------------------|---------------------------|------| | hoyolab.check | 手动触发检查米游社文章更新 | 管理员 | | hoyolab.list | 查看全局米游社监听配置 | 所有人 | | hoyolab.subscribe <uid> [regex] | 订阅米游社用户的文章更新(可选正则表达式过滤) | 所有人 | | hoyolab.subscriptions | 查看已订阅的米游社用户列表 | 所有人 | | hoyolab.unsubscribe <uid> | 取消订阅指定米游社用户 | 所有人 |

🚀 使用指南

1. 安装插件

npm install koishi-plugin-hoyolab-notifier

或在插件商城中搜索 koishi-plugin-hoyolab-notifier 进行安装。

2. 基本使用

  1. 订阅米游社用户:在群聊中发送命令 hoyolab.subscribe <uid>,例如 hoyolab.subscribe 160946056
  2. 使用标题过滤:发送命令 hoyolab.subscribe <uid> <regex>,例如 hoyolab.subscribe 160946056 原神
  3. 查看订阅列表:发送命令 hoyolab.subscriptions 查看当前群聊中的订阅
  4. 取消订阅:发送命令 hoyolab.unsubscribe <uid> 取消特定用户的订阅
  5. 手动触发检查:管理员发送命令 hoyolab.check 手动检查文章更新

📁 文件结构

src/
├── index.ts              # 插件主入口,命令注册和数据库定义
├── post-checker.ts       # 文章检查和消息发送逻辑
├── content-helper.ts     # 文章内容解析和处理
├── web-helper.ts         # 网络请求辅助函数,提供随机User-Agent
└── onebot-helper.ts      # OneBot适配器辅助函数

🔧 技术说明

  • 插件使用 axios 发送 HTTP 请求获取米游社文章和用户信息
  • 自动设置合适的请求头,包括 User-Agent、Origin 和 Referer
  • 文章内容解析支持文本、图片和视频等多种格式
  • 视频内容根据时长进行智能处理,长视频 (>1 分钟) 显示链接,短视频直接嵌入
  • 数据库结构包含用户订阅表和已发送文章记录表
  • 支持同时监控多个米游社用户,并向多个群聊发送通知

📝 注意事项

  • 订阅命令必须在群聊中使用,以便在该群聊中接收通知
  • 正则表达式必须是有效的,否则会提示语法错误
  • 同一用户在同一群聊中对同一米游社用户只能有一个订阅
  • 文章通知会@订阅者,确保订阅者能及时看到更新
  • 系统会记录已发送的文章,避免重复通知
  • 获取用户信息失败时会使用 UID 作为备用显示名称
  • 支持在配置文件中设置全局监控用户,无需手动订阅

🤝 贡献指南

欢迎提交 Issue 或 Pull Request 来帮助改进这个插件!

📄 许可证

本项目采用 MIT 许可证 - 详情请查看 LICENSE 文件