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-group-join-verifier

v0.1.1

Published

入群计算验证的 Koishi 插件

Readme

koishi-plugin-group-join-verifier

入群计算验证的 Koishi 插件:当新成员加入群聊后,延迟 3 秒发送一道简单算术题,要求在指定时间内作答。未通过验证前,该用户在群内发送的任何非正确答案消息都会被撤回;超时未通过将尝试移出该成员,并在群内提示。

  • 支持自定义消息模板,占位符:{at}{time}{number}
  • 可配置答题时长、是否撤回未通过时的消息、运算类型(加/减/乘)、操作数范围
  • 输入错误自动提醒(可自定义提示语)
  • 超时踢出时群内提示(可自定义提示语)
  • 调试模式:高权限(authority > 3)可用 verifier 命令在群内模拟入群验证(不会被踢)
  • 跨适配器兼容:踢人使用 bot.kickGuildMember(若可用),撤回消息使用 bot.deleteMessage

安装

npm i koishi-plugin-group-join-verifier
# 或者使用 yarn / pnpm

在 Koishi 控制台中启用插件,或在配置文件中添加:

{
  "plugins": {
    "group-join-verifier": {
      "time": 1,
      "messageTemplate": "欢迎加入群聊,{at} 请在 {time} 分钟内计算 {number} 的答案,直接发送在群聊即可。",
      "operations": ["+"],
      "minOperand": 1,
      "maxOperand": 10,
      "recallWrongAnswer": true,
      "successReply": "验证通过,欢迎交流!",
      "wrongReply": "答案不正确或无效,请在 {time} 分钟内计算 {number} 并只发送答案数字。",
      "timeoutKickNotice": "{at} 验证超时,已移出群聊。",
      "debug": false
    }
  }
}

注意:插件在 Koishi 中的标识为 group-join-verifier(即导出的 name)。

配置项

  • messageTemplate: string
    • 入群验证消息模板(大文本框),支持占位符:
      • {at}:@新入群用户
      • {time}:分钟数
      • {number}:算式文本(如 1+1
    • 默认:欢迎加入群聊,{at} 请在 {time} 分钟内计算 {number} 的答案,直接发送在群聊即可。
  • time: number
    • 答题时间(分钟),默认 1
  • recallWrongAnswer: boolean
    • 在通过验证前,撤回该用户在群里发送的所有消息,默认 true
  • operations: ('+' | '-' | '*')[]
    • 算式允许的运算,默认仅 +
  • minOperand: number
    • 操作数最小值(包含)。需小于或等于“操作数最大值”。建议与运算符搭配设置,避免出现过大或负数结果。默认 1
  • maxOperand: number
    • 操作数最大值(包含)。需大于或等于“操作数最小值”。建议与运算符搭配设置,避免出现过大或负数结果。默认 10
  • successReply?: string
    • 验证通过后的提示(留空不发送),默认 验证通过,欢迎交流!
  • wrongReply?: string
    • 输入错误或无效时的提示(支持 {at}{time}{number}),默认 答案不正确或无效,请在 {time} 分钟内计算 {number} 并只发送答案数字。
  • timeoutKickNotice?: string
    • 超时未通过后的群内提示(支持 {at}),默认 {at} 验证超时,已移出群聊。
  • debug?: boolean
    • 开启后,authority > 3 的用户可在群内使用 verifier 命令模拟入群验证(不会被踢出)。

工作流程

  1. 监听成员加入事件,延迟 3 秒发送一条包含算式的验证消息。
  2. time 分钟内等待该成员的消息:
    • 若消息中包含的数字与答案相同,则视为通过,可发送 successReply
    • 未通过验证前,该用户在群内发送的任何非正确答案消息都会被撤回,并发送 wrongReply 提示。
  3. 超时未通过时,若适配器/平台与权限允许,尝试移出该成员,并在群内发送 timeoutKickNotice

权限说明

  • 撤回消息需要机器人具备对应频道/群的“撤回/删除消息”权限。
  • 踢人需要机器人具备相应的群管理权限;若无权限或适配器不支持,插件将静默忽略错误。

兼容性

  • 运行于 Koishi v4(peerDependencies: ^4.16.0)。
  • Node.js 版本建议 >= 16(更高版本更佳)。

许可证

MIT