Skip to main content

插件描述

Project description

logo

✨ nonebot-plugin-user-perm ✨

LICENSE pypi python uv
ruff pre-commit

📖 介绍

设置群聊的某些普通用户使用插件的某个权限命令!

使用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


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_user_perm-0.2.2.tar.gz (5.5 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_user_perm-0.2.2-py3-none-any.whl (5.3 kB view details)

Uploaded Python 3

File details

Details for the file nonebot_plugin_user_perm-0.2.2.tar.gz.

File metadata

  • Download URL: nonebot_plugin_user_perm-0.2.2.tar.gz
  • Upload date:
  • Size: 5.5 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

Hashes for nonebot_plugin_user_perm-0.2.2.tar.gz
Algorithm Hash digest
SHA256 2d5b29618c3ad50efd3a8a011612fa8557ee374d60ea26b3c3d5f8f4346ad670
MD5 2db554421855a571bace84060944112e
BLAKE2b-256 57934355bca7961130762dfc6856408b41d5cf613a8d154de2d7ae12fba60c7f

See more details on using hashes here.

File details

Details for the file nonebot_plugin_user_perm-0.2.2-py3-none-any.whl.

File metadata

  • Download URL: nonebot_plugin_user_perm-0.2.2-py3-none-any.whl
  • Upload date:
  • Size: 5.3 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

Hashes for nonebot_plugin_user_perm-0.2.2-py3-none-any.whl
Algorithm Hash digest
SHA256 d95b157a3a49f38b957c5a0c5ec0e9e55aa33d6b53d90e441649e8ca1f34067b
MD5 1e702113d5b2f2388addd80427d546a2
BLAKE2b-256 ce81eeafa1e1da0fd52900c7d67c38fb84b80ca00a889c69dbfe510f311d4c9f

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