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

@dgck81lnn/koishi-plugin-auto-delete-response

v0.2.0

Published

Auto deleted responses service for Koishi

Readme

@dgck81lnn/koishi-plugin-auto-delete-response

npm

本插件提供了一个 autoDeleteResponse 服务,使用该服务代替 session.send() 发送消息,可使机器人在用户的消息被删除(撤回)时自动删除(撤回)发出的响应消息。

配置

timeout

通过 autoDeleteResponse.send() 发送响应及本插件的上下文过滤器内任何消息被删除的记录的时间限制,单位为毫秒。

用法

ctx.autoDeleteResponse.send(session: Session, fragment: Element.Fragment, options?: Universal.SendOptions): Promise<string[]>

替代 session.send(fragment, options) 使用。当引发本会话的消息被用户删除时,机器人会自动删除对应的所有通过此方法发出的消息。若调用本方法时,引发本会话的消息已在近期被删除,则会自动放弃发送。

ctx.autoDeleteResponse.action(action: Command.Action): Command.Action

用于包装指令的 action 回调函数。若本次指令调用为根调用(argv.root 为真;本次指令调用是由消息会话直接引发,而非通过 session.execute() 手动发起),则会将 action 的返回值(或抛出的 SessionError)用 autoDeleteResponse.send() 发送。目前不会处理 SessionError 以外的异常,因此“发生未知错误”的提示信息并不会被自动撤回。

示例

  1. ctx.middleware(async (session, next) => {
      if (session.content === "天王盖地虎") {
        await ctx.sleep(5000)
        ctx.autoDeleteResponse.send(session, "宝塔镇河妖")
        return
      }
      return next()
    })

    收到“天王盖地虎”时,机器人延迟 5 秒后通过本服务回复“宝塔镇河妖”。若在发送前 timeout 时间内用户撤回了这条“天王盖地虎”,则这次 ctx.autoDeleteResponse.send() 将会失效,“宝塔镇河妖”不会实际发送出去;若在“宝塔镇河妖”发送后 timeout 时间内用户撤回这条“天王盖地虎”,则机器人也会撤回“宝塔镇河妖”。

  2. ctx.command("echo <text:text>")
      .action(ctx.autoDeleteResponse.action(({ session }, text) => {
        if (!text) throw new SessionError(".expect-text")
        return h.text(text)
      }))
    
    ctx.i18n.define("zh-CN", "commands.echo", {
      description: "输出给定文本",
      messages: {
        "expect-text": "缺少文本。",
      },
    })

    一个简单的 echo 指令,当用户撤回指令消息时,使机器人也撤回响应。但若用户使用插值语法(如 other-command $(echo text))等方法间接调用该指令,则不会触发该机制。