mirror of
https://github.com/nonebot/nonebot2.git
synced 2025-07-27 16:21:28 +00:00
change rule
This commit is contained in:
@ -1,18 +1,17 @@
|
||||
#!/usr/bin/env python3
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
from nonebot.rule import Rule
|
||||
from nonebot.event import Event
|
||||
from nonebot.plugin import on_metaevent
|
||||
from nonebot.typing import Bot, Event
|
||||
|
||||
|
||||
def heartbeat(bot, event: Event) -> bool:
|
||||
def heartbeat(bot: Bot, event: Event) -> bool:
|
||||
return event.detail_type == "heartbeat"
|
||||
|
||||
|
||||
test_matcher = on_metaevent(Rule(heartbeat))
|
||||
test_matcher = on_metaevent(heartbeat)
|
||||
|
||||
|
||||
@test_matcher.handle()
|
||||
async def handle_heartbeat(bot, event: Event, state: dict):
|
||||
async def handle_heartbeat(bot: Bot, event: Event, state: dict):
|
||||
print("[i] Heartbeat")
|
||||
|
Reference in New Issue
Block a user