From 44fef77288687c4404397dfeb8fcfea126b973fb Mon Sep 17 00:00:00 2001 From: yanyongyu Date: Sat, 26 Sep 2020 16:33:30 +0800 Subject: [PATCH] :ambulance: fix matcher key parser --- nonebot/matcher.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/nonebot/matcher.py b/nonebot/matcher.py index a2a5ad66..2c660393 100644 --- a/nonebot/matcher.py +++ b/nonebot/matcher.py @@ -166,8 +166,8 @@ class Matcher(metaclass=MatcherMeta): raise PausedException async def _key_parser(bot: Bot, event: Event, state: dict): - # if key in state: - # return + if key in state and "_current_key" not in state: + return parser = args_parser or cls._default_parser if parser: await parser(bot, event, state) @@ -185,6 +185,8 @@ class Matcher(metaclass=MatcherMeta): async def wrapper(bot: Bot, event: Event, state: dict): await parser(bot, event, state) await func(bot, event, state) + if "_current_key" in state: + del state["_current_key"] cls.handlers.append(wrapper)