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.0.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.0-py3-none-any.whl (7.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: nonebot_plugin_word_censor-0.2.0.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.0.tar.gz
Algorithm Hash digest
SHA256 c02fa45177db8e0316c4159e5cc374573d16bd7aea54bc812d8a47920cb55621
MD5 82219ce451fb05482cb8f293f9a89b81
BLAKE2b-256 ddda74324f62c9c921b5d73627dfe279de681eb4acf5e02ac60809a722512357

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for nonebot_plugin_word_censor-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 9b40dde7ffbf0c243546280a2d70da7e64539faa6de3b884a5f0bddf4c86b667
MD5 f732c01acffe4f47b467d56386ab8039
BLAKE2b-256 c3c992b40dabb45b5f3413ff3fddbc17d5582d63efecb220fc89e34ad060c04c

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