change rule and event handle

This commit is contained in:
yanyongyu
2020-07-25 12:28:30 +08:00
parent 10f1ab70b4
commit a39c2e223a
8 changed files with 140 additions and 33 deletions

View File

@ -0,0 +1,18 @@
#!/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")