Skip to main content

一个用于拦截 Bot 发送包含敏感词或正则匹配内容的消息审查插件

Project description

nonebot

nonebot-plugin-word-censor

✨ 基于 NoneBot2 的词汇与正则消息审查拦截插件 ✨

license pypi python

📖 介绍

nonebot-plugin-word-censor 是一个用于审查 NoneBot2 机器人发送内容的插件。

它可以防止机器人因为意外触发某些关键词或匹配到特定正则表达式而发送不当消息。支持通过指令实时动态管理黑名单的功能。

💿 安装

使用 nb-cli 安装(推荐)
nb plugin install nonebot-plugin-word-censor
使用 pip 安装
pip install nonebot-plugin-word-censor

⚙️ 配置

在 NoneBot2 项目的 .env 文件中添加以下配置(可选):

SUPERUSERS = ["2428451170"]    # 管理员
SEND_WORD_PRIORITY = 100    # 优先级,没啥用

🎮 使用方法

⚠️ 注意:以下指令仅 SUPERUSER (超级用户) 可用。

1. 基础指令 (普通词汇)

指令 格式 说明
添加词汇 word blacklist add <内容> 将指定内容加入黑名单
删除词汇 word blacklist del <内容> 将指定内容移出黑名单

2. 高级指令 (正则表达式)

支持 Python re 模块的语法。

指令 格式 示例
添加正则 word blacklist add regex <表达式> ... add regex \d{11} (拦截手机号)
删除正则 word blacklist del regex <表达式> ... del regex \d{11}

3. 其他指令

  • 查看列表word blacklist list
    • 查看当前生效的所有规则(普通词汇会脱敏显示)。
  • 刷新配置word blacklist refresh
    • 如果你手动修改了 JSON 文件,可使用此指令热重载。
  • 帮助word blacklist help

本项目使用 MIT 许可证 开源

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

nonebot_plugin_word_censor-0.2.2.tar.gz (6.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

nonebot_plugin_word_censor-0.2.2-py3-none-any.whl (7.6 kB view details)

Uploaded Python 3

File details

Details for the file nonebot_plugin_word_censor-0.2.2.tar.gz.

File metadata

  • Download URL: nonebot_plugin_word_censor-0.2.2.tar.gz
  • Upload date:
  • Size: 6.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.2.1 CPython/3.13.5 Windows/11

File hashes

Hashes for nonebot_plugin_word_censor-0.2.2.tar.gz
Algorithm Hash digest
SHA256 daca8ec5ece169197df75fa1b48b1934c94369c7042d023ed045123c0e74418d
MD5 bc624f157675fd3d6dc727c77710880b
BLAKE2b-256 194d7e1a43e630496106e4bf6b851fd3bb10665791170cdcb78ad4b9ba6ec71b

See more details on using hashes here.

File details

Details for the file nonebot_plugin_word_censor-0.2.2-py3-none-any.whl.

File metadata

File hashes

Hashes for nonebot_plugin_word_censor-0.2.2-py3-none-any.whl
Algorithm Hash digest
SHA256 d220f72b29196a1ff5b8e8cae09a26ca834e3f9d4438c9e5d75eb812cf55009f
MD5 46c5a667faf3b90215f1a8c672cb012a
BLAKE2b-256 acd473c07ba9a176935ccdce169a3da5dec2bedd3e5e1ab8a6913ae04882017a

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page