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-message-recall

v0.1.0

Published

Reusable message recall helper for Koishi plugins

Readme

koishi-plugin-message-recall

共享的 Koishi 消息撤回工具,提供统一的撤回逻辑 / 配置,并且可以在多个插件之间复用。

特性

  • 控制台统一配置:默认开关、延迟、每个 action 的独立设置。
  • 提供 ctx.recall 服务,支持:
    • wrap(actionKey, handler):一行包裹指令,自动接管 session.send 与返回值。
    • send(session, actionKey, fragment):直接发送并安排撤回。
    • withSession(session, actionKey, callback):在任意异步流程中临时接管 session.send
  • 日志跟踪:可在 info / debug 两种级别查看发送、调度与撤回情况。

安装

npm i koishi-plugin-message-recall

koishi.yml 中启用插件即可在控制台看到配置入口。

基本用法

import { Context } from 'koishi'

export function apply(ctx: Context) {
  ctx.command('foo').action(
    ctx.recall.wrap('foo', async ({ session }) => {
      // 普通返回值会被自动发送并加入撤回队列
      return '这条消息会在默认延迟后撤回'
    }),
  )
}

如果希望手动控制发送:

ctx.command('bar').action(async ({ session }) => {
  await ctx.recall.withSession(session, 'bar', async (send) => {
    await send('第一条')
    await send('第二条')
  })
})

或直接调用 ctx.recall.send(session, 'baz', fragment)

配置项

| 选项 | 说明 | | --- | --- | | enabled | 全局开关 | | delay | 撤回延迟(秒) | | autoReply | wrap 时是否自动发送返回值 | | logLevel | info / debug | | actions | 通过 action key 定制 enabled / delay / autoReply |

约定

  • actionKey 由业务插件自定义,例如指令名、场景名等,只要保证唯一即可。
  • 插件会在 ctx.recall.wrap() 中临时覆盖 session.send,执行完毕后恢复。
  • 如果动作被禁用,wrap 会直接退化为原 handler,不做任何注入。

开源协议

MIT © magisk317