适用于nonebot2 v11的随机禁言一名群员或自己n分钟 插件
注意:需要给bot管理员才能使用。
🔧 开发环境
Nonebot2:2.0.0b5
python:3.8.13
操作系统:Windows10(Linux兼容性问题不大)
编辑器:pycharm
💿 安装
1. nb-cli安装(推荐)
在你bot工程的文件夹下,运行cmd(运行路径要对啊),执行nb命令安装插件,插件配置会自动添加至配置文件
nb plugin install nonebot_plugin_random_ban
2. 本地安装
将项目clone到你的机器人插件下的对应插件目录内(一般为机器人文件夹下的src/plugins),然后把nonebot_plugin_random_ban文件夹里的内容拷贝至上一级目录即可。
clone命令参考(得先装git,懂的都懂):
git clone https://github.com/Ikaros-521/nonebot_plugin_random_ban.git
也可以直接下载压缩包到插件目录解压,然后同样提取nonebot_plugin_random_ban至上一级目录。
目录结构: 你的bot/src/plugins/nonebot_plugin_random_ban/__init__.py
3. pip安装
pip install nonebot_plugin_random_ban
打开 nonebot2 项目的 bot.py 文件, 在其中写入
nonebot.load_plugin('nonebot_plugin_random_ban')
当然,如果是默认nb-cli创建的nonebot2的话,在bot路径pyproject.toml的[tool.nonebot]的plugins中添加nonebot_plugin_random_ban即可
pyproject.toml配置例如:
[tool.nonebot]
plugin_dirs = ["src/plugins"]
plugins = ["nonebot_plugin_random_ban"]
更新版本
nb plugin update nonebot_plugin_random_ban
🔧 配置
env配置
# nonebot_plugin_random_ban
# 任何人都可以使用 随机禁言,开启后将会迎来至暗时刻
anyone_can_random_ban = []
若某群想长期启动至暗时刻,配置参考:
# nonebot_plugin_random_ban
# 任何人都可以使用 随机禁言,开启后将会迎来至暗时刻
anyone_can_random_ban = [123456, 114514]
| 配置项 | 必填 | 默认值 | 说明 |
|---|---|---|---|
nonebot_plugin_random_ban |
否 | [] |
数组内配置开启至暗时刻的群号即可 |
🎉 功能
随机禁言一名群员或自己n分钟(n通过传入数字然后随机实现),简单粗暴。可以开启至暗时刻,就是所有人可以使用随禁命令,刺激。
👉 命令
随机禁言 或 随禁
命令结构:/随机禁言 [最大禁言时间] 或 /随禁 [最大禁言时间] (最大禁言时间不填默认60分钟内的随机)
例如:/随机禁言 或 /随禁 10 或 /随禁 10分 或 /随禁 10时 或 /随禁 10天
bot返回内容:
恭喜幸运儿:xxx 获得6分钟的禁言服务
口球 或 禁我
命令结构:/口球 [最大禁言时间] 或 /禁我 [最大禁言时间] (最大禁言时间不填默认60分钟内的随机)
例如:/口球 或 /禁我 10 或 /禁我 10分 或 /口球 10时 或 /口球 10天
bot返回内容:
恭喜您获得6分钟的禁言服务
开启至暗时刻
命令结构:/开启至暗时刻 或 /至暗时刻启动 或 /至暗时刻开启 或 /启动至暗时刻
例如:/开启至暗时刻
说明:至暗时刻就是所有人可以使用 /随禁 命令,将是一片腥风血雨。
bot返回内容:
本群开启 至暗时刻成功,开始狩猎吧!
关闭至暗时刻
命令结构:/关闭至暗时刻 或 /至暗时刻关闭 或 /停止至暗时刻 或 /至暗时刻停止
例如:/关闭至暗时刻
bot返回内容:
本群已关闭 至暗时刻,世界恢复和平。
⚙ 拓展
自行修改源码喵~
📝 更新日志
Metadata
Release files for nonebot-plugin-random-ban 0.2.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| nonebot_plugin_random_ban-0.2.1.tar.gz | 6.9 kB | Without provenance | Details for nonebot_plugin_random_ban-0.2.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| nonebot_plugin_random_ban-0.2.1-py3-none-any.whl | Python 3 | none | any | Details for nonebot_plugin_random_ban-0.2.1-py3-none-any.whl |
Total release size: 14.1 kB
Release files / nonebot_plugin_random_ban-0.2.1.tar.gz
| Download URL | nonebot_plugin_random_ban-0.2.1.tar.gz |
|---|---|
| Size | 6.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
9944d78035bd8e5181402696cc72353980c99c3f9a2a9779d1d1176e58c5a197
|
|
BLAKE2b-256 checksum How to use checksums |
f2df2ddc30c0a21d09f98646b67a841188fb8212603bf30fdfdc7c9f61f4dcab
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.4.2 CPython/3.10.11 Windows/10
|
Release files / nonebot_plugin_random_ban-0.2.1-py3-none-any.whl
| Download URL | nonebot_plugin_random_ban-0.2.1-py3-none-any.whl |
|---|---|
| Size | 7.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
96134cf06f9e86109dfa345e91377425fb3cd11d9dd025bdbb73925e2d6b93ce
|
|
BLAKE2b-256 checksum How to use checksums |
a483e756efcf2faf0adfae860c1a402f528d576dc3cd1f7337d29193e019153c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.4.2 CPython/3.10.11 Windows/10
|
Security for nonebot-plugin-random-ban 0.2.1
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.
No provenance found
None of the files in this release were uploaded with provenance metadata.
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.