📝 Update creating-a-matcher.md

This commit is contained in:
Lan 2021-01-01 19:21:46 +08:00 committed by GitHub
parent db7e10cb4d
commit 8f69b2449d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -115,16 +115,17 @@ rule 的出现使得 nonebot 对事件的响应可以非常自由nonebot 内
```python
from nonebot.rule import Rule
from nonebot.typing import T_State
async def async_checker(bot: Bot, event: Event, state: State) -> bool:
async def async_checker(bot: Bot, event: Event, state: T_State) -> bool:
return True
def sync_checker(bot: Bot, event: Event, state: State) -> bool:
def sync_checker(bot: Bot, event: Event, state: T_State) -> bool:
return True
def check(arg1, args2):
async def _checker(bot: Bot, event: Event, state: State) -> bool:
async def _checker(bot: Bot, event: Event, state: T_State) -> bool:
return bool(arg1 + arg2)
return Rule(_check)