检测群聊中广告的插件,撤回并禁言,转发管理员
Project description
📖 介绍
这是一个用于屏蔽群聊中广告的插件,诞生于一个朋友的需求。
通用匹配所有群聊消息,提取文本并对图片OCR,与预定义词库和用户定义词库进行模糊匹配。 会自动撤回并禁言,禁言时间可配置。 如你是管理员或群主,可以私聊bot订阅禁言通知,以防误禁言和扯皮。
[!TIP] 主要针对 QQ 群聊环境进行开发和测试,其他平台不保证可用。
DONE:
- 对图片进行 OCR 识别
- 对文本进行模糊匹配
- 排除字符对识别影响,如"代.理"
- 支持自定义屏蔽词
- 支持管理员/群主私聊订阅禁言通知
- 支持自定义禁言时间
- 支持分群可选是否启用插件(仅data)
TODO:
- 支持自定义屏蔽词文件路径
- 支持拆分字,近形字,拼音判断
- 支持分群可选是否禁言,撤回,仅通知管理
- 支持二维码识别
- 用户自定义屏蔽词文件路径读取
- 管理员/群主私聊调整插件配置
💿 安装
以下提到的方法 任选其一 即可
[推荐] 使用 nb-cli 安装
在 nonebot2 项目的根目录下打开命令行, 输入以下指令即可安装nb plugin install nonebot-plugin-noadpls
使用包管理器安装
在 nonebot2 项目的插件目录下, 打开命令行, 根据你使用的包管理器, 输入相应的安装命令pip
pip install nonebot-plugin-noadpls
pdm
pdm add nonebot-plugin-noadpls
poetry
poetry add nonebot-plugin-noadpls
conda
conda install nonebot-plugin-noadpls
打开 nonebot2 项目根目录下的 pyproject.toml 文件, 在 [tool.nonebot] 部分的 plugins 项里追加写入
[tool.nonebot]
plugins = [
# ...
"nonebot_plugin_noadpls"
]
⚙️ 配置
在 nonebot2 项目的 .env 文件中的可选配置
| 配置项 | 类型 | 默认值 | 说明 |
|---|---|---|---|
| noadpls__enable | Bool | True | 是否启用插件 |
| noadpls__priority | Int | 10 | 插件优先级 |
| *noadpls__ban_pre_text | List[str] | ["advertisement"] | 启用的预定义屏蔽词词库 |
- *详细内容请参见 TelechaBot/cleanse-speech
TL;DR 太长不看版
advertisement:默认中文广告词库pornographic:默认中文色情词库politics: 默认中文敏感词库general: 默认中文通用词库netease: 网易屏蔽词库
插件同时使用 nonebot-plugin-localstore 插件存储 可变配置,插件数据和缓存文件,具体配置方法请参见 nonebot-plugin-localstore 存储路径 和 nonebot-plugin-localstore 配置项
将会存储在 localstore 定义的配置存储文件中的配置项
| 配置项 | 类型 | 默认值 | 说明 |
|---|---|---|---|
| ban_time | List[int] | [60, 300, 1800, 3600, 86400] | 禁言时间列表 |
| ban_text | List[str] | [ ] | 用户自定义屏蔽词 |
| ban_text_path | List[str] | [ ] | 用户自定义屏蔽词文件路径(还没写好) |
[!WARNING] 不推荐用户自行更改可变配置文件
推荐使用私聊指令进行更新指令更新还没写好()
🎉 使用
指令表
| 指令 | 权限 | 需要@ | 范围 | 说明 |
|---|---|---|---|---|
| 所有人 | 否 | 群聊 | 通用匹配所有消息 | |
| *接收通知 群号 | 管理以上 | 否 | 私聊 | 开启接收禁言通知 |
| *关闭通知 群号 | 管理以上 | 否 | 私聊 | 取消接收禁言通知 |
| *nap_on **群号 | 管理以上 | 否 | 私聊 | 开启群检测 |
| *nap_off **群号 | 管理以上 | 否 | 私聊 | 关闭群检测 |
- *非管理以上权限也可私聊,但是会提示无权限
- **当在群聊环境中使用时,
群号会自动填充为当前群号
效果图
📊 统计
📞 联系
QQ:3214528055
Discord:@洛初
Telegram:@Furinature
吹水群:611124274
邮箱:gongfuture@outlook.com
💡 鸣谢
感谢帮忙测试的各位群友~
感谢以下项目:
- nonebot-plugin-localstore 提供了本地文件存储支持
- TelechaBot/cleanse-speech 使用了基础屏蔽机制和预定义词库
- nonebot_paddle_ocr 参考了图片处理部分逻辑并且使用了其在线OCR
- PaddleOCR 图片部分的OCR支持
- Nonebot 本插件运行的框架
以及,使用这个插件的你~
💰 赞助
点我 打开/关闭 赞助者列表
1212 ( 1 次赞助, 共 ¥5 ) 留言:小可爱 ( 1 次赞助, 共 ¥5 ) 留言:
W ( 1 次赞助, 共 ¥5 ) 留言:
淡淡*清香 ( 2 次赞助, 共 ¥14.9 ) 留言:
秋天的童话 ( 1 次赞助, 共 ¥5 ) 留言:
爱发电用户_hYpM ( 1 次赞助, 共 ¥5 ) 留言:
真 ( 1 次赞助, 共 ¥5 ) 留言:
语笑嫣然 ( 1 次赞助, 共 ¥5 ) 留言:
Elysia ( 1 次赞助, 共 ¥5 ) 留言: 看看腿喵
Serendipity ( 1 次赞助, 共 ¥5 ) 留言:
感谢大家的赞助!你们的赞助将是我继续创作的动力!
📜 许可证
本项目采用 MIT License 许可证,详情请参阅 LICENSE 文件。
📝 更新日志
最新正式版本
- Release 0.2.1 - v0.2.1 - 2025-06-29
Release 0.2.1
Feature
Fixed
- 修正管理和订阅指令超级用户不可用的问题 a659c208de76d7b520cffe1a17d72b578603c0c4
Full Changelog: https://github.com/LuoChu-NB2Dev/nonebot-plugin-noadpls/compare/v0.2.0...v0.2.1
最新预览版本
v0.4.0
[!WARNING]
破坏性变更 | BREAKING CHANGE
由于依赖安全性问题,不再支持Python 3.9 目前 最低版本Python 3.10
当前版本与上一版本无功能变更,Python3.9用户请勿更新此版本
CI/CD
- 发布工作流整合入组织仓库 87b901e4949a7473e724a510ce324bf21e8f88df
- 增加爱发电打赏用户感谢列表 87b901e4949a7473e724a510ce324bf21e8f88df
Dependence
- 更新Python最低版本为3.10 9a30fb3f16b24ecc632d47c2008a9bdbd98e0e1f
- 更新了一堆依赖 #37 #38 #39 #40 #41 #42
Full Changelog: https://github.com/LuoChu-NB2Dev/nonebot-plugin-noadpls/compare/v0.2.1...v0.4.0
更多Release请见 Releases
完整更新日志请见 CHANGELOG.md
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file nonebot_plugin_noadpls-0.4.0.tar.gz.
File metadata
- Download URL: nonebot_plugin_noadpls-0.4.0.tar.gz
- Upload date:
- Size: 27.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
96671493629b9b224ddd2746bc089f94f3badddbbfca4c3f8354c9ba67f8a9a2
|
|
| MD5 |
22dff365d0c37872fe23a2073febd824
|
|
| BLAKE2b-256 |
aac80f86b0ed5ae0eb5496c6c8def5ea3cb97268a62a30c52eb25b4be5a22461
|
Provenance
The following attestation bundles were made for nonebot_plugin_noadpls-0.4.0.tar.gz:
Publisher:
release.yml on LuoChu-NB2Dev/nonebot-plugin-noadpls
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
nonebot_plugin_noadpls-0.4.0.tar.gz -
Subject digest:
96671493629b9b224ddd2746bc089f94f3badddbbfca4c3f8354c9ba67f8a9a2 - Sigstore transparency entry: 834369516
- Sigstore integration time:
-
Permalink:
LuoChu-NB2Dev/nonebot-plugin-noadpls@0011cc779e74aa4a2bd3a243264b4b72ac200adf -
Branch / Tag:
refs/tags/v0.4.0 - Owner: https://github.com/LuoChu-NB2Dev
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@0011cc779e74aa4a2bd3a243264b4b72ac200adf -
Trigger Event:
push
-
Statement type:
File details
Details for the file nonebot_plugin_noadpls-0.4.0-py3-none-any.whl.
File metadata
- Download URL: nonebot_plugin_noadpls-0.4.0-py3-none-any.whl
- Upload date:
- Size: 30.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c993733ffaae6c8dd2b566e03cdf071c3beaa76fe5c498dabd1e5448421f6be1
|
|
| MD5 |
e39bbad19db35ceb0282511a23477e3e
|
|
| BLAKE2b-256 |
bf93ba49a59cfd398c43c1e35de6126bc857a52dbc4cfe51353a5c522847fa08
|
Provenance
The following attestation bundles were made for nonebot_plugin_noadpls-0.4.0-py3-none-any.whl:
Publisher:
release.yml on LuoChu-NB2Dev/nonebot-plugin-noadpls
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
nonebot_plugin_noadpls-0.4.0-py3-none-any.whl -
Subject digest:
c993733ffaae6c8dd2b566e03cdf071c3beaa76fe5c498dabd1e5448421f6be1 - Sigstore transparency entry: 834369519
- Sigstore integration time:
-
Permalink:
LuoChu-NB2Dev/nonebot-plugin-noadpls@0011cc779e74aa4a2bd3a243264b4b72ac200adf -
Branch / Tag:
refs/tags/v0.4.0 - Owner: https://github.com/LuoChu-NB2Dev
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@0011cc779e74aa4a2bd3a243264b4b72ac200adf -
Trigger Event:
push
-
Statement type: