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