1
0
forked from bot/app

🐛 hotfix: from mypy import

This commit is contained in:
2024-10-19 21:10:18 +08:00
parent f117da7ff3
commit 6b64a0c379
13 changed files with 122 additions and 614 deletions

View File

@ -11,8 +11,6 @@ Copyright (C) 2020-2024 LiteyukiStudio. All Rights Reserved
from queue import Queue
from liteyuki.comm.storage import shared_memory
from liteyuki.log import logger
from liteyuki.session.event import MessageEvent
from liteyuki.session.matcher import Matcher
from liteyuki.session.rule import Rule, empty_rule
@ -20,24 +18,6 @@ from liteyuki.session.rule import Rule, empty_rule
_matcher_list: list[Matcher] = []
_queue: Queue = Queue()
@shared_memory.on_subscriber_receive("event_to_liteyuki")
async def _(event: MessageEvent):
print("AA")
current_priority = -1
for i, matcher in enumerate(_matcher_list):
logger.info(f"Running matcher {matcher} for event: {event}")
await matcher.run(event)
# 同优先级不阻断,不同优先级阻断
if current_priority != matcher.priority:
current_priority = matcher.priority
if matcher.block:
break
else:
logger.info(f"No matcher matched for event: {event}")
print("BB")
def add_matcher(matcher: Matcher):
for i, m in enumerate(_matcher_list):
if m.priority < matcher.priority: