change rule

This commit is contained in:
yanyongyu
2020-08-14 17:41:24 +08:00
parent 04f4d5028e
commit 1dcc43161a
13 changed files with 252 additions and 192 deletions

View File

@ -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")