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

fraq-plugin-lexicon

v0.3.6

Published

支持多词库、精确与模糊匹配以及嵌套词条解析的 Fraq 插件

Readme

fraq-plugin-lexicon

为 Fraq 提供多词库、精确与模糊匹配、SQLite 持久化和嵌套词条解析能力。

需要 Fraq 1.1.0 或更高的 1.x 版本,不兼容 Fraq 0.x

安装

pnpm add fraq-plugin-lexicon @fraqjs/plugin-random
import { Context } from '@fraqjs/fraq';
import RandomPlugin from '@fraqjs/plugin-random';
import FraqPluginLexicon from 'fraq-plugin-lexicon';

const ctx = Context.fromUrl('http://localhost:30001');

ctx.install(RandomPlugin);
ctx.install(FraqPluginLexicon, {
  owners: [123456789],
  dataPath: 'data',
  databasePath: 'data/fraq-plugin-lexicon.sqlite',
  userInputTimeoutMs: 30_000,
});

owners 是机器人主人的 QQ 号列表。dataPath 是插件数据目录,默认值为 data;文件词条只能访问该目录,未单独设置 databasePath 时 SQLite 数据库也会创建在该目录下。databasePath 可单独覆盖数据库文件路径,默认值为 <dataPath>/fraq-plugin-lexicon.sqlitemaxOutputLength 可调整单次解析结果的最大字符数,默认值为 65536userInputTimeoutMs 可调整请求用户输入未指定词条级超时时间时的默认等待时间,默认值为 30000 毫秒。运行环境需要 Node.js 22.13 或更高版本。

管理命令

命令前缀由 Fraq 的命令路由配置决定。下表省略了路由前缀;例如前缀为 / 时,应发送 /词库 帮助

| 功能 | 命令 | 说明 | | --- | --- | --- | | 查看帮助 | 词库 帮助 | 查看插件支持的管理命令和词条格式 | | 创建词库 | 词库 创建 全局 <词库名>词库 创建 群 <词库名> | 创建全局词库或当前群的群词库 | | 删除词库 | 词库 删除库 全局 <词库名>词库 删除库 群 <词库名> | 删除指定作用域的词库及其中词条 | | 启用全局词库 | 词库 启用 <全局词库名> | 在当前群启用指定全局词库 | | 禁用全局词库 | 词库 禁用 <全局词库名> | 在当前群禁用指定全局词库 | | 查看词库 | 词库 列表 | 查看当前会话可管理和已启用的词库 | | 切换当前词库 | 词库 切换 <词库名> | 切换未指定词库名时使用的管理词库 | | 查询当前词库词条 | 词库 查询 <词条ID> | 按 ID 查询当前管理词库中的词条 | | 查询指定词库词条 | 词库 查询 <词库名> <词条ID> | 按 ID 查询指定词库中的词条 | | 修改当前词库词条 | 词库 修改 <词条ID> [问 <新问题>] 答 <新回答> | 修改当前管理词库中的词条;问题可省略 | | 修改指定词库词条 | 词库 修改 <词库名> <词条ID> [问 <新问题>] 答 <新回答> | 修改指定词库中的词条;问题可省略 | | 添加到当前词库 | 词库 添加 精确 问 <内容> 答 <内容>词库 添加 模糊 问 <内容> 答 <内容> | 向当前管理词库添加词条 | | 添加到指定词库 | 词库 添加 <词库名> 精确 问 <内容> 答 <内容>词库 添加 <词库名> 模糊 问 <内容> 答 <内容> | 向指定词库添加词条 | | 按 ID 删除当前词条 | 词库 删除 id <词条ID> | 按 ID 删除当前管理词库中的词条 | | 按问题删除当前词条 | 词库 删除 问 <内容> | 按问题删除当前管理词库中的词条 | | 按 ID 删除指定词条 | 词库 删除 <词库名> id <词条ID> | 按 ID 删除指定词库中的词条 | | 按问题删除指定词条 | 词库 删除 <词库名> 问 <内容> | 按问题删除指定词库中的词条 |

群词库由群主、群管理员和机器人主人管理;全局词库仅机器人主人可以管理。

插件首次启动时会创建全局“默认”词库;每个群首次使用插件时会创建该群的“默认”词库。不指定词库名的查询、修改、添加和删除命令使用当前管理词库,初始为“默认”。修改词条时可以省略 问 <新问题>,此时保留原问题和原匹配方式。

文档