mirror of
https://github.com/nonebot/nonebot2.git
synced 2025-07-28 00:31:14 +00:00
✨ finish typing change
This commit is contained in:
@ -1,16 +1,17 @@
|
||||
from nonebot.typing import State
|
||||
from nonebot.typing import T_State
|
||||
from nonebot.adapters import Bot, Event
|
||||
from nonebot.adapters.cqhttp import HeartbeatMetaEvent
|
||||
|
||||
from . import match
|
||||
|
||||
|
||||
async def heartbeat(bot: Bot, event: Event, state: State) -> bool:
|
||||
return event.detail_type == "heartbeat"
|
||||
async def heartbeat(bot: Bot, event: Event, state: T_State) -> bool:
|
||||
return isinstance(event, HeartbeatMetaEvent)
|
||||
|
||||
|
||||
test = match.on_metaevent(rule=heartbeat)
|
||||
|
||||
|
||||
@test.receive()
|
||||
async def handle_heartbeat(bot: Bot, event: Event, state: State):
|
||||
async def handle_heartbeat(bot: Bot):
|
||||
print("[i] Heartbeat")
|
||||
|
Reference in New Issue
Block a user