mirror of
https://github.com/nonebot/nonebot2.git
synced 2024-11-28 06:31:41 +08:00
19 lines
397 B
Python
19 lines
397 B
Python
#!/usr/bin/env python3
|
|
# -*- coding: utf-8 -*-
|
|
|
|
from nonebot.rule import Rule
|
|
from nonebot.event import Event
|
|
from nonebot.plugin import on_metaevent
|
|
|
|
|
|
def heartbeat(bot, event: Event) -> bool:
|
|
return event.detail_type == "heartbeat"
|
|
|
|
|
|
test_matcher = on_metaevent(Rule(heartbeat))
|
|
|
|
|
|
@test_matcher.handle()
|
|
async def handle_heartbeat(bot, event: Event, state: dict):
|
|
print("[i] Heartbeat")
|