安装
插件仍在快速开发中,遇到问题还请务必提 issue。
从 PyPI 安装(推荐)
- 使用 nb-cli
nb plugin install nonebot-plugin-manager
- 使用 poetry
poetry add nonebot-plugin-manager
- 使用 pip
pip install nonebot-plugin-manager
从 GitHub 安装(不推荐)
git clone https://github.com/Jigsaw111/nonebot_plugin_manager.git
使用
权限
权限与 UNIX 的权限类似,分为三种用户:超级用户、用户、群。
每种用户包含读、写、执行 3 个权限,分别对应数字 4、2、1,将 3 个权限对应的数字累加,最终得到的值即可作为每种用户所具有的权限。
关于会话中使用什么模式,可参照下表:
| 仅供参考 | 私聊读 | 群聊读 | 私聊写 | 群聊写 | 私聊执行 | 群聊执行 |
|---|---|---|---|---|---|---|
| 超级用户 | 超级用户 | 群 | 超级用户 | 超级用户 | 超级用户 | 群 |
| 用户 | 用户 | 群 | 用户 | 无权限 | 用户 | 用户 & 群 |
| 群管理员 | 不存在 | 群 | 不存在 | 用户 & 群 | 不存在 | 用户 & 群 |
包含 Matcher 的插件默认权限为755,不含 Matcher 的插件默认权限为311。
例:
npm chmod 757 nonebot_plugin_nodice命令可将 nonebot_plugin_nodice 的权限设置为757即超级用户可写可读可执行,用户可读可执行,群可写可读可执行。
只有超级用户可以修改插件的权限,可以使用绝对模式(八进制数字模式),符号模式指定文件的权限。
命令
使用前请先确保命令前缀为空,否则请在以下命令前加上命令前缀 (默认为/)。
-
npm ls查看当前会话插件列表-s, --store互斥参数,查看插件商店列表(仅超级用户可用)-u <user_id>, --user <user_id>互斥参数,查看指定用户插件列表(仅超级用户可用)-g <group_id>, --group <group_id>互斥参数,查看指定群插件列表(仅超级用户可用)-a, --all可选参数,查看所有插件(包括不含 Matcher 的插件)
-
npm info <插件名>查询插件信息 (仅超级用户可用) -
npm chmod <mode> <plugin ...>设置插件权限(仅超级用户可用)mode必选参数,需要设置的权限,参考上文plugin ...必选参数,需要设置的插件名-a, --all可选参数,全选插件-r, --reverse可选参数,反选插件
-
npm block <plugin ...>禁用当前会话插件(需要权限)plugin ...必选参数,需要禁用的插件名-a, --all可选参数,全选插件-r, --reverse可选参数,反选插件-u <user_id ...>, --user <user_id ...>可选参数,管理指定用户设置(仅超级用户可用)-g <group_id ...>, --group <group_id ...>可选参数,管理指定群设置(仅超级用户可用)
-
npm unblock <plugin ...>启用当前会话插件(需要权限)plugin ...必选参数,需要禁用的插件名-a, --all可选参数,全选插件-r, --reverse可选参数,反选插件-u <user_id ...>, --user <user_id ...>可选参数,管理指定用户设置(仅超级用户可用)-g <group_id ...>, --group <group_id ...>可选参数,管理指定群设置(仅超级用户可用)
Q&A
- 这是什么?
基于 import hook 的插件管理器,能够在不重启 NoneBot2 的情况下分群管理插件。 - 有什么用?
在 NoneBot2 仍然缺乏插件管理机制的时期暂时充当插件管理器。 - 自造 Rule 不是更好?
Rule 当然更好且更有效率,但是 Rule 是一种侵入式的插件管理方式,需要用户自行修改其他插件的源码,这对于管理从 PyPI 安装的插件来说相对复杂。而使用本插件,你不需要修改其他插件的任何内容,更符合插件之间松耦合的设计原则。
Metadata
Release files for nonebot-plugin-manager 0.5.16
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-manager-0.5.16.tar.gz | 10.2 kB | Without provenance | Details for nonebot-plugin-manager-0.5.16.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| nonebot_plugin_manager-0.5.16-py3-none-any.whl | Python 3 | none | any | Details for nonebot_plugin_manager-0.5.16-py3-none-any.whl |
Total release size: 20.3 kB
Release files / nonebot-plugin-manager-0.5.16.tar.gz
| Download URL | nonebot-plugin-manager-0.5.16.tar.gz |
|---|---|
| Size | 10.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d5d833a5b405b7da5dffc124e740cfbdb3164aa5c43d26393f0d05cebb3dc999
|
|
BLAKE2b-256 checksum How to use checksums |
112ee910d2020da46585490e03e07933fa4b8c021d8d4bc77d104a9fe7c80fc0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
pdm/2.7.4 CPython/3.10.6
|
Release files / nonebot_plugin_manager-0.5.16-py3-none-any.whl
| Download URL | nonebot_plugin_manager-0.5.16-py3-none-any.whl |
|---|---|
| Size | 10.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
f75dbfe96ec2308a7dea7019539e2e6a0725a13631573f29228f4005d837318a
|
|
BLAKE2b-256 checksum How to use checksums |
f90dbe8ac56a1cb0bd40b0acb5b12b57faec6299941b0fb316c74d32c3ef639f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
pdm/2.7.4 CPython/3.10.6
|
Security for nonebot-plugin-manager 0.5.16
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.