Skip to main content
logo

✨ pErithacus ✨

LICENSE pypi python uv
ruff

简介

pErithacus 是一个基于 NoneBot2 框架的聊天插件,可以根据用户设定的关键词自动回复相关内容。该插件提供了完整的词条管理功能,让用户能够轻松创建、编辑和管理自定义回复内容。
pErithacus,名称来自灰鹦鹉(Psittacus erithacus),具有极强的语言模仿能力

功能特性

  • 📝 词条管理:添加、删除、修改、查看词条
  • 🔍 多种匹配模式:支持精准匹配、模糊匹配和正则表达式匹配
  • ⏰ 定时触发:支持使用 cron 表达式设置定时自动触发回复
  • 🎲 随机回复:可设置多个回复内容并随机选择
  • 🌐 作用域管理:支持按群组或私聊会话分别管理不同的词条
  • 🔗 别名词条:可以为词条设置别名,增加使用的灵活性

安装方法

使用 nb-cli 安装 在 nonebot2 项目的根目录下打开命令行, 输入以下指令即可安装
nb plugin install nonebot-plugin-pErithacus --upgrade

使用 pypi 源安装

nb plugin install nonebot-plugin-pErithacus --upgrade -i "https://pypi.org/simple"

使用清华源安装

nb plugin install nonebot-plugin-pErithacus --upgrade -i "https://pypi.tuna.tsinghua.edu.cn/simple"
使用包管理器安装 在 nonebot2 项目的插件目录下, 打开命令行, 根据你使用的包管理器, 输入相应的安装命令
pip
pip install nonebot-plugin-pErithacus
uv
uv add nonebot-plugin-pErithacus

安装仓库 master 分支

uv add git+https://github.com/SnowMoonSS/nonebot-plugin-pErithacus@master
pdm
pdm add nonebot-plugin-pErithacus

安装仓库 master 分支

pdm add git+https://github.com/SnowMoonSS/nonebot-plugin-pErithacus@master
poetry
poetry add nonebot-plugin-pErithacus

安装仓库 master 分支

poetry add git+https://github.com/SnowMoonSS/nonebot-plugin-pErithacus@master

打开 nonebot2 项目根目录下的 pyproject.toml 文件, 在 [tool.nonebot] 部分追加写入

plugins = ["nonebot_plugin_perithacus"]
使用 nbr 安装(使用 uv 管理依赖可用)

nbr 是一个基于 uv 的 nb-cli,可以方便地管理 nonebot2

nbr plugin install nonebot-plugin-pErithacus

使用 pypi 源安装

nbr plugin install nonebot-plugin-pErithacus -i "https://pypi.org/simple"

使用清华源安装

nbr plugin install nonebot-plugin-pErithacus -i "https://pypi.tuna.tsinghua.edu.cn/simple"

🎉 使用

启动

启动收到如下提示时:

目标数据库未更新到最新迁移, 是否更新? [y/N]:

输入 y 然后回车确认,数据库将自动更新到最新迁移。

基本命令

pe <子命令> [选项...] [参数...]

发送 pe --help 查看详细的命令帮助信息。详情可查看command.py

add | 添加

添加新的词条到系统中。

语法:

pe add <关键词> <回复内容> [选项...]

参数:

  • 关键词: 要匹配的关键词。支持图片、@、纯文字,以及混合消息。如果关键词内包含空格,请使用英文的双引号包裹。
  • 回复内容: 当匹配成功时,BOT 会发送的内容。支持图片、@、纯文字,以及混合消息。所有参数以及关键词以外的部分都会被当做回复内容。

选项:

  • -m, --match: 匹配方式(精准/模糊),默认为精准。
  • -r, --random: 是否随机回复,默认为True。为否时回复为最后添加的内容。
  • -c, --cron: 定时触发的cron表达式,默认为空。详见CRON 表达式
  • -s, --scope: 作用域。该参数配合<关键词>进行词条查询,默认为当前会话所在作用域。指定作用域时,将会在指定作用域匹配对应的词条,并向其添加作用域。详见作用域。
  • -g, --reg: 正则匹配的正则表达式,默认为空。当存在正则表达式时,将不会进行模糊匹配。
  • -a, --alias: 为词条添加别名,默认为空。一次只能添加一个别名。别名中包含多种内容或空格时,使用英文的双引号包裹。

del | 删除

删除指定的词条。

语法:

pe del <关键词> [选项]

参数:

  • 关键词: 要删除的词条关键词

选项:

  • -s, --scope: 作用域。要删除的词条所处的作用域。默认为当前会话所在的作用域。指定作用域时,将会根据指定作用域匹配对应的词条,然后删除该词条。详见作用域

list

列出所有词条或指定词条的详细内容。

语法:

pe list [页码] [选项...]

参数:

  • 页码 (可选): 列出指定页的词条。默认为1。

选项:

  • -s, --scope: 列出指定作用域的词条。默认为当前会话所在作用域。详见作用域
  • -a, --all: 列出所有作用域的词条。默认为False。
  • -f, --force: 列出包含已被删除的词条。默认为False。

search | 搜索

根据关键词搜索相关的词条。

语法:

pe search <关键词> [页码] [选项...]

参数:

  • 关键词: 搜索关键词
  • 页码 (可选): 列出指定页的词条。默认为1。

选项:

  • -s, --scope: 列出指定作用域的词条。默认为当前会话所在作用域。详见作用域
  • -a, --all: 列出所有作用域的词条。默认为False。

check | 查看

查看指定词条的配置信息。

语法:

pe check <词条ID> [选项]

参数:

  • 词条ID: 要查看的词条ID

选项:

  • -f, --force: 强制查看已被标记为删除的词条

detail | 详情

查看指定词条的详细内容。

语法:

pe detail <词条ID> [页码] [选项]

参数:

  • 词条ID: 要查看的词条ID。
  • 页码 (可选): 列出指定页的词条。默认为1。

选项:

  • -f, --force: 强制查看已被标记为删除的内容。
  • -a, --all: 列出包含已删除的所有内容。默认为False。

edit | 修改

修改已有词条的配置。

语法:

pe edit <关键词> [选项...]

参数:

  • 关键词: 要修改的词条关键词

选项:

  • -m, --match: 修改当前的匹配方式(精准/模糊)。默认为精准。
  • -r, --random: 是否随机回复,默认为True。为否时回复为最后添加的内容。
  • -c, --cron: 替换当前的cron表达式。详见CRON 表达式
  • -s, --scope: 作用域。该参数配合<关键词>进行词条查询,默认为当前会话所在作用域。指定作用域时,将会根据指定作用域对应的词条,并向其添加作用域。详见作用域
  • -g, --regex: 修改正则匹配的正则表达式。当存在正则表达式时,将不会进行模糊匹配。
  • -a, --alias: 为词条添加别名。一次只能添加一个别名。别名中包含多种内容或空格时,使用英文的双引号包裹。
  • -A, --del_alias: 删除词条的指定别名。通过pe check <词条ID>查看别名序号。
  • -C, --del_content: 根据指定的内容ID,删除词条内的相应内容。

匹配方式

精准匹配

消息内容必须与关键词完全一致才会触发回复。

模糊匹配

消息内容被关键词包含在内即可触发回复。模糊匹配只能处理纯文本消息。

正则匹配

消息内容符合指定的正则表达式才会触发回复。当存在正则表达式时,将不会进行模糊匹配。
正则匹配只会处理纯文本消息。

CRON 表达式

定时任务使用标准的 cron 表达式格式,以#进行分割:
分 时 日 月 周

例如:0#0#8#*#*#* 表示每天上午8点触发

可根据crontab guru编写cron表达式。添加定时消息时记得用#替换掉空格。

作用域

作用域用于控制词条的有效范围:

  • 以 g 开头表示群组作用域,如 g123456
  • 以 u 开头表示私聊作用域,如 u123456
  • 多个作用域使用,进行分割,如 g123456,u123456

示例

添加一条简单的问候语:

pe add hello 你好!

添加每日定时提醒,每天早上9点发送消息:

pe add 晨报 新的一天开始了! -c 0#9#*#*#*

添加带模糊匹配的词条:

pe add 笑话 这是一个有趣的笑话 -m 模糊

查看当前作用域的所有未删除词条:

pe list

查看词库所有未删除的词条:

pe list -a

搜索相关词条:

pe search 笑话

查看 ID 为 1 的词条的配置信息:

pe check 1

删除词条中的序号为 1 的别名:

pe edit 笑话 -A 1

删除词条中的序号为 2、5、7 的别名:

pe edit 笑话 -A 2,5,7

删除词条中的序号为 2、3、4、5、7 的别名:

pe edit 笑话 -A 2-5,7

删除词条中的编号为 2、3、4、5、7 的内容:

pe edit 笑话 -C 2-5,7

数据存储

数据存储在 nonebot-plugin-localstore 定义的 data 目录下。

在不同的操作系统中,数据存储路径不同:

  • macOS: ~/Library/Application Support/nonebot2
  • Unix: ~/.local/share/nonebot2 or in $XDG_DATA_HOME, if defined
  • Win XP (not roaming): C:\Documents and Settings<username>\Application Data\nonebot2
  • Win 7 (not roaming): C:\Users<username>\AppData\Local\nonebot2

可在.env文件中添加LOCALSTORE_USE_CWD = True使其保存在当前工作目录下

Metadata

Release files for nonebot-plugin-pErithacus 1.4.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for nonebot-plugin-pErithacus 1.4.4
File Size Uploaded Provenance Actions
nonebot_plugin_perithacus-1.4.4.tar.gz 29.3 kB With provenance Details for nonebot_plugin_perithacus-1.4.4.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for nonebot-plugin-pErithacus 1.4.4
File Interpreter ABI Platform Actions
nonebot_plugin_perithacus-1.4.4-py3-none-any.whl Python 3 none any Details for nonebot_plugin_perithacus-1.4.4-py3-none-any.whl

Total release size: 70.8 kB

Release files / nonebot_plugin_perithacus-1.4.4.tar.gz

Download URL nonebot_plugin_perithacus-1.4.4.tar.gz
Size 29.3 kB
Tags Source
SHA-256 checksum
How to use checksums
63476df79365d2e7c9e076e91f8dee1c5e2d89d926766105d75b442b6c092ea2
BLAKE2b-256 checksum
How to use checksums
26df65cf022aafcab7054c648a178f869c656ca84684dbe3e213d9236b54ed81
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jun 16, 2026.

Transparency log

Release files / nonebot_plugin_perithacus-1.4.4-py3-none-any.whl

Download URL nonebot_plugin_perithacus-1.4.4-py3-none-any.whl
Size 41.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d26f4092eb9ec98cc3458cb5823c19544b4d509419d4f76c02576c8a9941bc1b
BLAKE2b-256 checksum
How to use checksums
4ccc5d694df66f011351c866e2064ee059c2f830d7ff42b17909a02f9cb81b96
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jun 16, 2026.

Transparency log

Security for nonebot-plugin-pErithacus 1.4.4

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for nonebot_plugin_perithacus-1.4.4.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jun 16, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page