🐛 fix #69 stop running expired matcher

This commit is contained in:
yanyongyu 2020-11-19 22:04:44 +08:00 committed by pull[bot]
parent 829f47c5e7
commit 17747f94c8

View File

@ -92,8 +92,9 @@ async def _check_matcher(priority: int, bot: Bot, event: Event,
async def _check(Matcher: Type[Matcher], bot: Bot, event: Event, async def _check(Matcher: Type[Matcher], bot: Bot, event: Event,
state: dict) -> Optional[Type[Matcher]]: state: dict) -> Optional[Type[Matcher]]:
try: try:
if await Matcher.check_perm( if (Matcher.expire_time and datetime.now() <= Matcher.expire_time
bot, event) and await Matcher.check_rule(bot, event, state): ) and await Matcher.check_perm(
bot, event) and await Matcher.check_rule(bot, event, state):
return Matcher return Matcher
except Exception as e: except Exception as e:
logger.opt(colors=True, exception=e).error( logger.opt(colors=True, exception=e).error(