mirror of
https://github.com/nonebot/nonebot2.git
synced 2024-11-28 04:46:25 +08:00
Docs: 修复事件处理函数文档代码范例中缺失的 import (#1982)
This commit is contained in:
parent
0162360cfe
commit
e308d4cfac
@ -26,7 +26,8 @@ import Messenger from "@site/src/components/Messenger";
|
||||
|
||||
顾名思义,“事件处理函数装饰器”是一个[装饰器(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)中所展示的包装用法相同。例如:
|
||||
|
||||
```python {5-7} title=weather/__init__.py
|
||||
```python {6-8} title=weather/__init__.py
|
||||
from nonebot.rule import to_me
|
||||
from nonebot.plugin import on_command
|
||||
|
||||
weather = on_command("天气", rule=to_me(), aliases={"weather", "查天气"}, priority=10, block=True)
|
||||
|
Loading…
Reference in New Issue
Block a user