mirror of
				https://github.com/nonebot/nonebot2.git
				synced 2025-10-30 22:46:40 +00:00 
			
		
		
		
	📝 Update creating-a-matcher.md
This commit is contained in:
		| @@ -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) | ||||
|   | ||||
		Reference in New Issue
	
	Block a user