Skip to main content

插件描述

Project description

logo

✨ nonebot-plugin-user-perm ✨

LICENSE pypi python uv
ruff pre-commit

📖 介绍

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

使用onebotv11适配器提供 isPermUser 函数给其他插件使用在响应器中

注意:isPermUser只接受群消息事件GroupMessageEvent

isPermUser 将判断这条消息发送人是否是该群聊设置的特定普通用户 + super用户

默认数据格式:{'super': [ ], 'group': { } }

例如:{'super': [12345], 'group': {'某个qq群号': [112233, 223344]}}
每个[ ]里填入普通用户的qq号(int类型)

💿 安装

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

🎉 使用

示例:在其他插件上使用

...
from nonebot import require
require("nonebot_plugin_user_perm")
from nonebot_plugin_user_perm import isPermUser

weather = on_command("天气", permission=isPermUser)` 

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(isPermUser)
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.1.6.tar.gz (5.2 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.1.6-py3-none-any.whl (5.0 kB view details)

Uploaded Python 3

File details

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

File metadata

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

Hashes for nonebot_plugin_user_perm-0.1.6.tar.gz
Algorithm Hash digest
SHA256 329f96e16c94fddefff2f2cc2c5a518067ad2cdfeb58454284ae3210b78ca815
MD5 7e5b4df9fe4caefa3ed6eec92e9f30e7
BLAKE2b-256 a3ec8627296f5bb43fc072180b009253de743b1b4a84b0cd709180532f2c1527

See more details on using hashes here.

File details

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

File metadata

  • Download URL: nonebot_plugin_user_perm-0.1.6-py3-none-any.whl
  • Upload date:
  • Size: 5.0 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.1.6-py3-none-any.whl
Algorithm Hash digest
SHA256 d49fa99a5fe328817b76204a4f11c020ca098c0ea8a8764bbabdd91e36e8c20f
MD5 bca4f36d16e7f277fdc678b192d21280
BLAKE2b-256 920b033c19e362e03b3458b2ed16b47407e11730b8d330d4147aafcb087f0b85

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