nonebot2/tests/test_plugins/test_group/matches.py

18 lines
398 B
Python
Raw Normal View History

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