mirror of
https://github.com/nonebot/nonebot2.git
synced 2025-09-15 00:16:40 +00:00
📝 refactor dependency-injection documents (#791)
* 📝 update dependency-injection docs * 🚨 auto fix by pre-commit hooks * 📝 fix some indent * 📝 fix description * 📝 add create callable in DI docs * 🚨 auto fix by pre-commit hooks * 📝 delete unused params in docs * 📝 update di docs * 🚨 auto fix by pre-commit hooks * 📝 update di doc Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: yanyongyu <42488585+yanyongyu@users.noreply.github.com>
This commit is contained in:
@ -56,7 +56,7 @@ async def _(bot: Bot, event: PrivateMessageEvent):
|
||||
|
||||
## 进阶
|
||||
|
||||
事件处理函数重载机制同样支持被 `matcher.got` 等装饰器装饰的函数。 例如:
|
||||
事件处理函数重载机制同样支持被 `matcher.got` 等装饰器装饰的函数。例如:
|
||||
|
||||
```python
|
||||
@matcher.got("key1", prompt="群事件提问")
|
||||
@ -70,3 +70,7 @@ async def _(bot: Bot, event: PrivateMessageEvent):
|
||||
```
|
||||
|
||||
只有触发事件符合的函数才会触发装饰器。
|
||||
|
||||
:::warning 注意
|
||||
bot 和 event 参数具有最高的检查优先级,因此,如果参数类型不符合,所有的依赖项 `Depends` 等都不会被执行。
|
||||
:::
|
||||
|
Reference in New Issue
Block a user