mirror of
https://github.com/nonebot/nonebot2.git
synced 2025-07-16 19:11:00 +00:00
✅ add test case
This commit is contained in:
@ -8,9 +8,14 @@ async def heartbeat(bot: Bot, event: Event, state: T_State) -> bool:
|
||||
return isinstance(event, HeartbeatMetaEvent)
|
||||
|
||||
|
||||
test_matcher = on_metaevent(heartbeat)
|
||||
async def factory(bot: Bot, event: Event) -> T_State:
|
||||
return {"factory": True}
|
||||
|
||||
|
||||
test_matcher = on_metaevent(heartbeat, state_factory=factory)
|
||||
|
||||
|
||||
@test_matcher.receive()
|
||||
async def handle_heartbeat(bot: Bot, event: Event, state: T_State):
|
||||
print(state)
|
||||
print("[i] Heartbeat")
|
||||
|
Reference in New Issue
Block a user