From 0b6a1ca1a4eb6de9fda507f9496d86630f5d21f2 Mon Sep 17 00:00:00 2001 From: yanyongyu Date: Thu, 19 Nov 2020 22:04:44 +0800 Subject: [PATCH] :bug: fix #69 stop running expired matcher --- nonebot/message.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/nonebot/message.py b/nonebot/message.py index ffd26b81..76f14b25 100644 --- a/nonebot/message.py +++ b/nonebot/message.py @@ -92,8 +92,9 @@ async def _check_matcher(priority: int, bot: Bot, event: Event, async def _check(Matcher: Type[Matcher], bot: Bot, event: Event, state: dict) -> Optional[Type[Matcher]]: try: - if await Matcher.check_perm( - bot, event) and await Matcher.check_rule(bot, event, state): + if (Matcher.expire_time and datetime.now() <= Matcher.expire_time + ) and await Matcher.check_perm( + bot, event) and await Matcher.check_rule(bot, event, state): return Matcher except Exception as e: logger.opt(colors=True, exception=e).error(