mirror of
https://github.com/nonebot/nonebot2.git
synced 2024-11-24 09:05:04 +08:00
🚑 fix matcher key parser
This commit is contained in:
parent
bbeea86fd5
commit
44fef77288
@ -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)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user