nonebot2/tests/test_plugins/test_group/matches.py

16 lines
325 B
Python
Raw Normal View History

2020-12-03 17:55:03 +00:00
from nonebot.typing import Bot, Event
from . import match
async def heartbeat(bot: Bot, event: Event, state: dict) -> bool:
return event.detail_type == "heartbeat"
test = match.on_metaevent(rule=heartbeat)
@test.receive()
async def handle_heartbeat(bot: Bot, event: Event, state: dict):
print("[i] Heartbeat")