mirror of
https://github.com/nonebot/nonebot2.git
synced 2025-10-24 03:26:38 +00:00
1.3 KiB
1.3 KiB
contentSidebar, sidebarDepth
| contentSidebar | sidebarDepth |
|---|---|
| true | 0 |
NoneBot.permission 模块
权限
每个 Matcher 拥有一个 Permission ,其中是 异步 PermissionChecker 的集合,只要有一个 PermissionChecker 检查结果为 True 时就会继续运行。
:::tip 提示
PermissionChecker 既可以是 async function 也可以是 sync function
:::
MESSAGE
- 说明: 匹配任意
message类型事件,仅在需要同时捕获不同类型事件时使用。优先使用 message type 的 Matcher。
NOTICE
- 说明: 匹配任意
notice类型事件,仅在需要同时捕获不同类型事件时使用。优先使用 notice type 的 Matcher。
REQUEST
- 说明: 匹配任意
request类型事件,仅在需要同时捕获不同类型事件时使用。优先使用 request type 的 Matcher。
METAEVENT
- 说明: 匹配任意
meta_event类型事件,仅在需要同时捕获不同类型事件时使用。优先使用 meta_event type 的 Matcher。
USER(*user, perm=<nonebot.permission.Permission object>)
-
说明
在白名单内且满足 perm
-
参数
-
*user: str: 白名单 -
perm: Permission: 需要同时满足的权限
-
SUPERUSER
- 说明: 匹配任意超级用户消息类型事件