🐛 fix state error when matcher update(fix #397)

This commit is contained in:
yanyongyu 2021-05-31 21:49:25 +08:00
parent accbf57776
commit 830276d110
2 changed files with 22 additions and 4 deletions

View File

@ -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)

View File

@ -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