🔖 Pre Release 2.0.0a6

This commit is contained in:
yanyongyu
2020-11-18 15:12:48 +08:00
parent 0a6008ddc0
commit 39f508bbdf
36 changed files with 120 additions and 61 deletions

View File

@ -0,0 +1,7 @@
# 深入
## 它如何工作?
<!-- TODO: how to work -->
~~未填坑~~

View File

@ -0,0 +1 @@
# 权限控制

View File

@ -0,0 +1 @@
# 运行时插槽

View File

@ -0,0 +1 @@
# 定时任务

View File

@ -18,12 +18,6 @@ NoneBot2 是一个可扩展的 Python 异步机器人框架,它会对机器人
需要注意的是NoneBot 仅支持 Python 3.7+ 及 CQHTTP(OneBot) 插件 v11+。
## 它如何工作?
<!-- TODO: how to work -->
~~未填坑~~
## 特色
- 提供直观的测试前端

View File

@ -5,3 +5,5 @@
- 请千万注意事件处理器的优先级设定
- 在匹配规则中请勿使用耗时极长的函数
- 同一个用户可以**跨群**(**私聊**)继续他的事件处理(除非做出权限限制,将在后续介绍)
如果你还不能满足,前往 [进阶](../advanced/README.md) 获得更多的功能信息。

View File

@ -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 提示
如果在父插件中需要定义事件响应器,应在**子插件被加载后**进行定义
:::
## 运行结果

View File

@ -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",