From 830276d110f0d928035f0926b62090f04b1694ee Mon Sep 17 00:00:00 2001 From: yanyongyu Date: Mon, 31 May 2021 21:49:25 +0800 Subject: [PATCH] :bug: fix state error when matcher update(fix #397) --- nonebot/matcher.py | 24 ++++++++++++++++++++---- pages/changelog.md | 2 ++ 2 files changed, 22 insertions(+), 4 deletions(-) diff --git a/nonebot/matcher.py b/nonebot/matcher.py index c81941ff..e3f894c4 100644 --- a/nonebot/matcher.py +++ b/nonebot/matcher.py @@ -587,13 +587,21 @@ class Matcher(metaclass=MatcherMeta): self.handlers.insert(0, handler) # type: ignore updater = self.__class__._default_type_updater if updater: - type_ = await updater(bot, event, state, self.type) + type_ = await updater( + bot, + event, + state_, # type: ignore + self.type) else: type_ = "message" updater = self.__class__._default_permission_updater if updater: - permission = await updater(bot, event, state, self.permission) + permission = await updater( + bot, + event, + state_, # type: ignore + self.permission) else: permission = USER(event.get_session_id(), perm=self.permission) @@ -615,13 +623,21 @@ class Matcher(metaclass=MatcherMeta): except PausedException: updater = self.__class__._default_type_updater if updater: - type_ = await updater(bot, event, state, self.type) + type_ = await updater( + bot, + event, + state_, # type: ignore + self.type) else: type_ = "message" updater = self.__class__._default_permission_updater if updater: - permission = await updater(bot, event, state, self.permission) + permission = await updater( + bot, + event, + state_, # type: ignore + self.permission) else: permission = USER(event.get_session_id(), perm=self.permission) diff --git a/pages/changelog.md b/pages/changelog.md index d2b7e038..8831578c 100644 --- a/pages/changelog.md +++ b/pages/changelog.md @@ -11,6 +11,8 @@ sidebar: auto - 修改 `Matcher` 属性 `module` 类型 - 新增 `Matcher` 属性 `plugin_name` `module_name` `module_prefix` - 移除 `bot.call_api` 参数 `self_id` 切换机器人支持 +- 修复 `type_updater` `permission_updater` 未传递的错误 +- 修复 `type_updater` `permission_updater` 参数 `state` 错误 ## v2.0.0a13.post1