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