Skip to content

Commit 9a73132

Browse files
Xfjie314yanyongyu
andauthored
📝 Docs: 调整文档 on_command import 路径 (#3747)
Co-authored-by: Ju4tCode <[email protected]>
1 parent 1079cf3 commit 9a73132

File tree

4 files changed

+8
-8
lines changed

4 files changed

+8
-8
lines changed

website/docs/tutorial/handler.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@ import Messenger from "@site/src/components/Messenger";
2727
顾名思义,“事件处理函数装饰器”是一个[装饰器(decorator)](https://docs.python.org/zh-cn/3/glossary.html#term-decorator),那么它的使用方法也同[函数定义](https://docs.python.org/zh-cn/3/reference/compound_stmts.html#function-definitions)中所展示的包装用法相同。例如:
2828

2929
```python {6-8} title=weather/__init__.py
30+
from nonebot import on_command
3031
from nonebot.rule import to_me
31-
from nonebot.plugin import on_command
3232

3333
weather = on_command("天气", rule=to_me(), aliases={"weather", "查天气"}, priority=10, block=True)
3434

@@ -46,8 +46,8 @@ async def handle_function():
4646
事件响应器操作与事件处理函数装饰器类似,通常作为事件响应器 `Matcher`[类方法](https://docs.python.org/zh-cn/3/library/functions.html#classmethod)存在,因此事件响应器操作的调用方法也是 `Matcher.func()` 的形式。不过不同的是,事件响应器操作并不是装饰器,因此并不需要@进行标注。
4747

4848
```python {8,9} title=weather/__init__.py
49+
from nonebot import on_command
4950
from nonebot.rule import to_me
50-
from nonebot.plugin import on_command
5151

5252
weather = on_command("天气", rule=to_me(), aliases={"weather", "查天气"}, priority=10, block=True)
5353

website/versioned_docs/version-2.4.2/tutorial/handler.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@ import Messenger from "@site/src/components/Messenger";
2727
顾名思义,“事件处理函数装饰器”是一个[装饰器(decorator)](https://docs.python.org/zh-cn/3/glossary.html#term-decorator),那么它的使用方法也同[函数定义](https://docs.python.org/zh-cn/3/reference/compound_stmts.html#function-definitions)中所展示的包装用法相同。例如:
2828

2929
```python {6-8} title=weather/__init__.py
30+
from nonebot import on_command
3031
from nonebot.rule import to_me
31-
from nonebot.plugin import on_command
3232

3333
weather = on_command("天气", rule=to_me(), aliases={"weather", "查天气"}, priority=10, block=True)
3434

@@ -46,8 +46,8 @@ async def handle_function():
4646
事件响应器操作与事件处理函数装饰器类似,通常作为事件响应器 `Matcher`[类方法](https://docs.python.org/zh-cn/3/library/functions.html#classmethod)存在,因此事件响应器操作的调用方法也是 `Matcher.func()` 的形式。不过不同的是,事件响应器操作并不是装饰器,因此并不需要@进行标注。
4747

4848
```python {8,9} title=weather/__init__.py
49+
from nonebot import on_command
4950
from nonebot.rule import to_me
50-
from nonebot.plugin import on_command
5151

5252
weather = on_command("天气", rule=to_me(), aliases={"weather", "查天气"}, priority=10, block=True)
5353

website/versioned_docs/version-2.4.3/tutorial/handler.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@ import Messenger from "@site/src/components/Messenger";
2727
顾名思义,“事件处理函数装饰器”是一个[装饰器(decorator)](https://docs.python.org/zh-cn/3/glossary.html#term-decorator),那么它的使用方法也同[函数定义](https://docs.python.org/zh-cn/3/reference/compound_stmts.html#function-definitions)中所展示的包装用法相同。例如:
2828

2929
```python {6-8} title=weather/__init__.py
30+
from nonebot import on_command
3031
from nonebot.rule import to_me
31-
from nonebot.plugin import on_command
3232

3333
weather = on_command("天气", rule=to_me(), aliases={"weather", "查天气"}, priority=10, block=True)
3434

@@ -46,8 +46,8 @@ async def handle_function():
4646
事件响应器操作与事件处理函数装饰器类似,通常作为事件响应器 `Matcher`[类方法](https://docs.python.org/zh-cn/3/library/functions.html#classmethod)存在,因此事件响应器操作的调用方法也是 `Matcher.func()` 的形式。不过不同的是,事件响应器操作并不是装饰器,因此并不需要@进行标注。
4747

4848
```python {8,9} title=weather/__init__.py
49+
from nonebot import on_command
4950
from nonebot.rule import to_me
50-
from nonebot.plugin import on_command
5151

5252
weather = on_command("天气", rule=to_me(), aliases={"weather", "查天气"}, priority=10, block=True)
5353

website/versioned_docs/version-2.4.4/tutorial/handler.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@ import Messenger from "@site/src/components/Messenger";
2727
顾名思义,“事件处理函数装饰器”是一个[装饰器(decorator)](https://docs.python.org/zh-cn/3/glossary.html#term-decorator),那么它的使用方法也同[函数定义](https://docs.python.org/zh-cn/3/reference/compound_stmts.html#function-definitions)中所展示的包装用法相同。例如:
2828

2929
```python {6-8} title=weather/__init__.py
30+
from nonebot import on_command
3031
from nonebot.rule import to_me
31-
from nonebot.plugin import on_command
3232

3333
weather = on_command("天气", rule=to_me(), aliases={"weather", "查天气"}, priority=10, block=True)
3434

@@ -46,8 +46,8 @@ async def handle_function():
4646
事件响应器操作与事件处理函数装饰器类似,通常作为事件响应器 `Matcher`[类方法](https://docs.python.org/zh-cn/3/library/functions.html#classmethod)存在,因此事件响应器操作的调用方法也是 `Matcher.func()` 的形式。不过不同的是,事件响应器操作并不是装饰器,因此并不需要@进行标注。
4747

4848
```python {8,9} title=weather/__init__.py
49+
from nonebot import on_command
4950
from nonebot.rule import to_me
50-
from nonebot.plugin import on_command
5151

5252
weather = on_command("天气", rule=to_me(), aliases={"weather", "查天气"}, priority=10, block=True)
5353

0 commit comments

Comments
 (0)