mirror of
https://github.com/nonebot/nonebot2.git
synced 2025-07-28 00:31:14 +00:00
🔖 Pre Release 2.0.0a6
This commit is contained in:
7
archive/2.0.0a6/advanced/README.md
Normal file
7
archive/2.0.0a6/advanced/README.md
Normal file
@ -0,0 +1,7 @@
|
||||
# 深入
|
||||
|
||||
## 它如何工作?
|
||||
|
||||
<!-- TODO: how to work -->
|
||||
|
||||
~~未填坑~~
|
1
archive/2.0.0a6/advanced/permission.md
Normal file
1
archive/2.0.0a6/advanced/permission.md
Normal file
@ -0,0 +1 @@
|
||||
# 权限控制
|
1
archive/2.0.0a6/advanced/runtime-hook.md
Normal file
1
archive/2.0.0a6/advanced/runtime-hook.md
Normal file
@ -0,0 +1 @@
|
||||
# 运行时插槽
|
1
archive/2.0.0a6/advanced/scheduler.md
Normal file
1
archive/2.0.0a6/advanced/scheduler.md
Normal file
@ -0,0 +1 @@
|
||||
# 定时任务
|
@ -18,12 +18,6 @@ NoneBot2 是一个可扩展的 Python 异步机器人框架,它会对机器人
|
||||
|
||||
需要注意的是,NoneBot 仅支持 Python 3.7+ 及 CQHTTP(OneBot) 插件 v11+。
|
||||
|
||||
## 它如何工作?
|
||||
|
||||
<!-- TODO: how to work -->
|
||||
|
||||
~~未填坑~~
|
||||
|
||||
## 特色
|
||||
|
||||
- 提供直观的测试前端
|
@ -5,3 +5,5 @@
|
||||
- 请千万注意事件处理器的优先级设定
|
||||
- 在匹配规则中请勿使用耗时极长的函数
|
||||
- 同一个用户可以**跨群**(**私聊**)继续他的事件处理(除非做出权限限制,将在后续介绍)
|
||||
|
||||
如果你还不能满足,前往 [进阶](../advanced/README.md) 获得更多的功能信息。
|
@ -83,7 +83,39 @@ if __name__ == "__main__":
|
||||
|
||||
<!-- TODO: 子插件 -->
|
||||
|
||||
~~待填坑~~
|
||||
在插件中同样可以加载子插件,例如如下插件目录结构:
|
||||
|
||||
<!-- prettier-ignore-start -->
|
||||
:::vue
|
||||
foo_plugin
|
||||
├── `plugins`
|
||||
│ ├── `sub_plugin1`
|
||||
│ │ └── \_\_init\_\_.py
|
||||
│ └── `sub_plugin2.py`
|
||||
├── `__init__.py`
|
||||
└── config.py
|
||||
:::
|
||||
<!-- prettier-ignore-end -->
|
||||
|
||||
在插件目录下的 `__init__.py` 中添加如下代码:
|
||||
|
||||
```python
|
||||
from pathlib import Path
|
||||
|
||||
import nonebot
|
||||
|
||||
# store all subplugins
|
||||
_sub_plugins = set()
|
||||
# load sub plugins
|
||||
_sub_plugins |= nonebot.load_plugins(
|
||||
str((Path(__file__).parent / "plugins").resolve()))
|
||||
```
|
||||
|
||||
插件将会被加载并存储于 `_sub_plugins` 中。
|
||||
|
||||
:::tip 提示
|
||||
如果在父插件中需要定义事件响应器,应在**子插件被加载后**进行定义
|
||||
:::
|
||||
|
||||
## 运行结果
|
||||
|
@ -15,6 +15,10 @@
|
||||
"text": "指南",
|
||||
"link": "/guide/"
|
||||
},
|
||||
{
|
||||
"text": "进阶",
|
||||
"link": "/advanced/"
|
||||
},
|
||||
{
|
||||
"text": "API",
|
||||
"link": "/api/"
|
||||
@ -22,6 +26,10 @@
|
||||
{
|
||||
"text": "插件广场",
|
||||
"link": "/plugin-store"
|
||||
},
|
||||
{
|
||||
"text": "更新日志",
|
||||
"link": "/changelog"
|
||||
}
|
||||
],
|
||||
"sidebarDepth": 2,
|
||||
@ -52,6 +60,19 @@
|
||||
]
|
||||
}
|
||||
],
|
||||
"/advanced/": [
|
||||
{
|
||||
"title": "进阶",
|
||||
"collapsable": false,
|
||||
"sidebar": "auto",
|
||||
"children": [
|
||||
"",
|
||||
"scheduler",
|
||||
"permission",
|
||||
"runtime-hook"
|
||||
]
|
||||
}
|
||||
],
|
||||
"/api/": [
|
||||
{
|
||||
"title": "NoneBot Api Reference",
|
Reference in New Issue
Block a user