插件描述
Project description
📖 介绍
设置群聊的某些普通用户使用插件的某个权限命令!
使用onebotv11适配器提供 is_perm_user 函数给其他插件使用在响应器中
注意:is_perm_user只接受群消息事件GroupMessageEvent
is_perm_user将判断这条消息发送人是否是该群聊设置的特定普通用户 + super用户
默认数据格式:{'super': [ ], 'group': { } }
例如:{'super': [12345], 'group': {'某个qq群号': [112233, 223344]}}
每个[ ]里填入普通用户的qq号(int类型)
💿 安装
【XXX】使用 nb-cli 安装
在 nonebot2 项目的根目录下打开命令行, 输入以下指令即可安装nb plugin install nonebot-plugin-user-perm --upgrade
使用 pypi 源安装
nb plugin install nonebot-plugin-user-perm --upgrade -i "https://pypi.org/simple"
使用清华源安装
nb plugin install nonebot-plugin-user-perm --upgrade -i "https://pypi.tuna.tsinghua.edu.cn/simple"
使用包管理器安装
在 nonebot2 项目的插件目录下, 打开命令行, 根据你使用的包管理器, 输入相应的安装命令uv
uv add nonebot-plugin-user-perm
安装仓库 master 分支
uv add git+https://github.com/dontdot/nonebot-plugin-user-perm@master
pdm
pdm add nonebot-plugin-user-perm
安装仓库 master 分支
pdm add git+https://github.com/dontdot/nonebot-plugin-user-perm@master
poetry
poetry add nonebot-plugin-user-perm
安装仓库 master 分支
poetry add git+https://github.com/dontdot/nonebot-plugin-user-perm@master
打开 nonebot2 项目根目录下的 pyproject.toml 文件, 在 [tool.nonebot] 部分追加写入
plugins = ["nonebot_plugin_user_perm"]
使用 nbr 安装(使用 uv 管理依赖可用)
nbr 是一个基于 uv 的 nb-cli,可以方便地管理 nonebot2
nbr plugin install nonebot-plugin-user-perm
使用 pypi 源安装
nbr plugin install nonebot-plugin-user-perm -i "https://pypi.org/simple"
使用清华源安装
nbr plugin install nonebot-plugin-user-perm -i "https://pypi.tuna.tsinghua.edu.cn/simple"
⚙️ 配置
使用nonebot-plugin-localstore持久化保存数据
可在 nonebot2 项目的.env文件中添加以下配置,使数据文件保存在bot项目下的data目录
LOCALSTORE_USE_CWD=True
🎉 使用
提供以下4个方法:
| 方法 | 参数 | 说明 |
|---|---|---|
| add_user | user_id | 在当前群聊增加一个权限用户 |
| del_user | user_id | 在当前群聊删除一个权限用户 |
| is_perm_user | 无 | 检查当前信息发送人是否是在权限用户中 |
| get_users | group_id, mode | 获取该群聊的权限用户, mode默认为0,包含global用户,mode=1则排除global用户 |
示例:在其他插件上使用
...
from nonebot import require
require("nonebot_plugin_user_perm")
from nonebot_plugin_user_perm import is_perm_user
weather = on_command("天气", permission=is_perm_user)`
or
...
from nonebot import require
require("nonebot_plugin_user_perm")
from nonebot_plugin_user_perm import isPermUser
any_permission = SUPERUSER | GROUP_ADMIN | GROUP_OWNER | Permission(is_perm_user)
weather = on_command("天气", permission=any_permission)
🎨 效果图
如果有效果图的话
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_user_perm-0.3.0.tar.gz.
File metadata
- Download URL: nonebot_plugin_user_perm-0.3.0.tar.gz
- Upload date:
- Size: 6.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.11.3 {"installer":{"name":"uv","version":"0.11.3","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
81e6317263fbd39655ac94c6d178d552379c102382b81d0df45bf76dbc10c560
|
|
| MD5 |
0e0c89ebfd2209ec30585be87f0a9394
|
|
| BLAKE2b-256 |
580e11a7ed1384fdfc300260df0977c1685ea59a2b1ea7bbe55fb916beeacf01
|
File details
Details for the file nonebot_plugin_user_perm-0.3.0-py3-none-any.whl.
File metadata
- Download URL: nonebot_plugin_user_perm-0.3.0-py3-none-any.whl
- Upload date:
- Size: 5.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.11.3 {"installer":{"name":"uv","version":"0.11.3","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
571217c037d67049929badef53b80e90acf7abdfdb96ff196e69a9649b228ed3
|
|
| MD5 |
23dc57bf3033e97e35cdc336c8d562c6
|
|
| BLAKE2b-256 |
e71c827659d817ed0e83a7a3da0a66fb95f1d17df839cbc2c9cefb3b4856a754
|