Skip to content

Commit

Permalink
🔀 Merge pull request #61
Browse files Browse the repository at this point in the history
hot fix #60
  • Loading branch information
yanyongyu authored Nov 18, 2020
2 parents 5efe190 + 39f508b commit 04a3712
Show file tree
Hide file tree
Showing 46 changed files with 197 additions and 71 deletions.
File renamed without changes.
7 changes: 7 additions & 0 deletions archive/2.0.0a6/advanced/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# 深入

## 它如何工作?

<!-- TODO: how to work -->

~~未填坑~~
1 change: 1 addition & 0 deletions archive/2.0.0a6/advanced/permission.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# 权限控制
1 change: 1 addition & 0 deletions archive/2.0.0a6/advanced/runtime-hook.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# 运行时插槽
1 change: 1 addition & 0 deletions archive/2.0.0a6/advanced/scheduler.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# 定时任务
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,6 @@ NoneBot2 是一个可扩展的 Python 异步机器人框架,它会对机器人

需要注意的是,NoneBot 仅支持 Python 3.7+ 及 CQHTTP(OneBot) 插件 v11+。

## 它如何工作?

<!-- TODO: how to work -->

~~未填坑~~

## 特色

- 提供直观的测试前端
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,5 @@
- 请千万注意事件处理器的优先级设定
- 在匹配规则中请勿使用耗时极长的函数
- 同一个用户可以**跨群**(**私聊**)继续他的事件处理(除非做出权限限制,将在后续介绍)

如果你还不能满足,前往 [进阶](../advanced/README.md) 获得更多的功能信息。
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -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 提示
如果在父插件中需要定义事件响应器,应在**子插件被加载后**进行定义
:::

## 运行结果

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,21 @@
"text": "指南",
"link": "/guide/"
},
{
"text": "进阶",
"link": "/advanced/"
},
{
"text": "API",
"link": "/api/"
},
{
"text": "插件广场",
"link": "/plugin-store"
},
{
"text": "更新日志",
"link": "/changelog"
}
],
"sidebarDepth": 2,
Expand Down Expand Up @@ -52,6 +60,19 @@
]
}
],
"/advanced/": [
{
"title": "进阶",
"collapsable": false,
"sidebar": "auto",
"children": [
"",
"scheduler",
"permission",
"runtime-hook"
]
}
],
"/api/": [
{
"title": "NoneBot Api Reference",
Expand Down
17 changes: 16 additions & 1 deletion docs/.vuepress/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,10 @@ module.exports = context => ({
nav: [
{ text: "主页", link: "/" },
{ text: "指南", link: "/guide/" },
{ text: "进阶", link: "/advanced/" },
{ text: "API", link: "/api/" },
{ text: "插件广场", link: "/plugin-store" }
{ text: "插件广场", link: "/plugin-store" },
{ text: "更新日志", link: "/changelog" }
],
sidebarDepth: 2,
sidebar: {
Expand Down Expand Up @@ -110,6 +112,19 @@ module.exports = context => ({
]
}
],
"/advanced/": [
{
title: "进阶",
collapsable: false,
sidebar: "auto",
children: [
"",
"scheduler",
"permission",
"runtime-hook"
]
}
],
"/api/": [
{
title: "NoneBot Api Reference",
Expand Down
2 changes: 1 addition & 1 deletion docs/.vuepress/versions.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[
"2.0.0a5",
"2.0.0a6",
"2.0.0a4"
]
7 changes: 7 additions & 0 deletions docs/advanced/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# 深入

## 它如何工作?

<!-- TODO: how to work -->

~~未填坑~~
1 change: 1 addition & 0 deletions docs/advanced/permission.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# 权限控制
1 change: 1 addition & 0 deletions docs/advanced/runtime-hook.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# 运行时插槽
1 change: 1 addition & 0 deletions docs/advanced/scheduler.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# 定时任务
6 changes: 0 additions & 6 deletions docs/guide/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,6 @@ NoneBot2 是一个可扩展的 Python 异步机器人框架,它会对机器人

需要注意的是,NoneBot 仅支持 Python 3.7+ 及 CQHTTP(OneBot) 插件 v11+。

## 它如何工作?

<!-- TODO: how to work -->

~~未填坑~~

## 特色

- 提供直观的测试前端
Expand Down
2 changes: 2 additions & 0 deletions docs/guide/end-or-start.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,5 @@
- 请千万注意事件处理器的优先级设定
- 在匹配规则中请勿使用耗时极长的函数
- 同一个用户可以**跨群**(**私聊**)继续他的事件处理(除非做出权限限制,将在后续介绍)

如果你还不能满足,前往 [进阶](../advanced/README.md) 获得更多的功能信息。
34 changes: 33 additions & 1 deletion docs/guide/loading-a-plugin.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 提示
如果在父插件中需要定义事件响应器,应在**子插件被加载后**进行定义
:::

## 运行结果

Expand Down
2 changes: 1 addition & 1 deletion nonebot/message.py
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ async def handle_event(bot: Bot, event: Event):
results = await asyncio.gather(*pending_tasks, return_exceptions=True)

for result in results:
if result is StopPropagation:
if isinstance(result, StopPropagation):
if not break_flag:
break_flag = True
logger.debug("Stop event propagation")
Expand Down
14 changes: 14 additions & 0 deletions pages/changelog.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---
sidebar: auto
---

# 更新日志

## v2.0.0a6

- 修复 block 失效问题 (hotfix)

## v2.0.0a5

- 更新插件指南文档
- 修复临时事件响应器运行后删除造成的多次响应问题
Loading

0 comments on commit 04a3712

Please sign in to comment.