Docs: 修复事件处理函数文档代码范例中缺失的 import (#1982)

This commit is contained in:
Lptr-byte 2023-05-07 00:56:22 +08:00 committed by GitHub
parent 0162360cfe
commit e308d4cfac
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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)中所展示的包装用法相同。例如: 顾名思义,“事件处理函数装饰器”是一个[装饰器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 from nonebot.plugin import on_command
weather = on_command("天气", rule=to_me(), aliases={"weather", "查天气"}, priority=10, block=True) weather = on_command("天气", rule=to_me(), aliases={"weather", "查天气"}, priority=10, block=True)