Entari 用户插件
Project description
entari-plugin-user
Entari 用户系统插件,用于统一管理用户信息、跨平台账号绑定和权限等级控制。
安装
pip install entari-plugin-chronicle
# or use pdm
pdm add entari-plugin-chronicle
# or use uv
uv add entari-plugin-chronicle
配置
| 配置项 | 必填 | 默认值 |
|---|---|---|
| user_token_prefix | 否 | entari/ |
使用
查看用户信息
/user
改名
/user -n <username>
/callme <username>
绑定
/bind [-r|--revoke]
授权
[!NOTE] 本项目的权限管理了参考 Koishi 的方案
我们也推荐开发者按照其标准进行管理
- 1 级:所有用户,只能够接触有限的功能
- 2 级:高级用户,能够接触几乎一切机器人的功能
- 3 级:管理员,能够直接操作机器人事务
- 4 级:高级管理员,能够管理其他账号
- 5 级:超级管理员(SUPERUSER)
/auth <level> -u <@用户>
/auth --superuser [token]
插件适配
获取用户信息
from arclet.entari import command
from entari_plugin_user import User, UserSession # entari:plugin
@command.on("me")
async def _(session: UserSession):
await session.send(f"You're {session.user_name}({session.platform_id})")
权限过滤
from arclet.entari import command, propagate
from entari_plugin_user import Authorization, only_superuser # entari:plugin
@command.on("ban")
@propagate(Authorization(3))
async def _ban():
...
@command.on("sudo")
@only_superuser
async def _sudo():
...
鸣谢
koishijs/koishi: 提供权限管理规范he0119/nonebot-plugin-user:本项目直接参考
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
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 entari_plugin_user-0.1.2.tar.gz.
File metadata
- Download URL: entari_plugin_user-0.1.2.tar.gz
- Upload date:
- Size: 8.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.10.7 {"installer":{"name":"uv","version":"0.10.7","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 |
75aed6f8d9fa66b1c260688a4ec9d27c6fa2f6a8c9d2133c8d6fef4b281a57fd
|
|
| MD5 |
578f92ea57d0e31905f55b1147665aa8
|
|
| BLAKE2b-256 |
c6d042f9b4c8ac43829b23a391dfc1981105d0e716a878e321eac96c530cc063
|
File details
Details for the file entari_plugin_user-0.1.2-py3-none-any.whl.
File metadata
- Download URL: entari_plugin_user-0.1.2-py3-none-any.whl
- Upload date:
- Size: 16.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.10.7 {"installer":{"name":"uv","version":"0.10.7","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 |
3570de42c6190e2530038426dadfa2b616322f6dfb1a6f03ba6f656b8b748711
|
|
| MD5 |
c9498e01ccb09440ce2e3117d8fec8b7
|
|
| BLAKE2b-256 |
7dca17b6b18f5628fdfceb82d02b023cfd622540efac925035e599c10ea4a2c5
|