nonebot2/tests/test_plugins/test_group/matches.py

17 lines
362 B
Python
Raw Normal View History

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