2020-12-17 21:09:30 +08:00
|
|
|
from nonebot.typing import T_State
|
2020-08-24 17:59:36 +08:00
|
|
|
from nonebot.plugin import on_metaevent
|
2020-12-17 21:09:30 +08:00
|
|
|
from nonebot.adapters import Bot, Event
|
|
|
|
from nonebot.adapters.cqhttp import HeartbeatMetaEvent
|
2020-07-25 12:28:30 +08:00
|
|
|
|
|
|
|
|
2020-12-17 21:09:30 +08:00
|
|
|
async def heartbeat(bot: Bot, event: Event, state: T_State) -> bool:
|
|
|
|
return isinstance(event, HeartbeatMetaEvent)
|
2020-07-25 12:28:30 +08:00
|
|
|
|
|
|
|
|
2020-08-14 17:41:24 +08:00
|
|
|
test_matcher = on_metaevent(heartbeat)
|
2020-07-25 12:28:30 +08:00
|
|
|
|
|
|
|
|
2020-08-23 10:45:26 +08:00
|
|
|
@test_matcher.receive()
|
2020-12-17 21:09:30 +08:00
|
|
|
async def handle_heartbeat(bot: Bot, event: Event, state: T_State):
|
2020-07-25 12:28:30 +08:00
|
|
|
print("[i] Heartbeat")
|