mirror of
https://github.com/aiogram/aiogram.git
synced 2026-04-08 16:37:47 +00:00
Fix sequence check behavior in StateFilter
This commit is contained in:
parent
7c14a6b16b
commit
96c6395f37
1 changed files with 5 additions and 4 deletions
|
|
@ -37,11 +37,12 @@ class StateFilter(BaseFilter):
|
|||
allowed_states = cast(Sequence[StateType], self.state)
|
||||
for allowed_state in allowed_states:
|
||||
if isinstance(allowed_state, str) or allowed_state is None:
|
||||
if allowed_state == "*":
|
||||
if allowed_state == "*" or raw_state == allowed_state:
|
||||
return True
|
||||
return raw_state == allowed_state
|
||||
elif isinstance(allowed_state, (State, StatesGroup)):
|
||||
return allowed_state(event=obj, raw_state=raw_state)
|
||||
if allowed_state(event=obj, raw_state=raw_state):
|
||||
return True
|
||||
elif isclass(allowed_state) and issubclass(allowed_state, StatesGroup):
|
||||
return allowed_state()(event=obj, raw_state=raw_state)
|
||||
if allowed_state()(event=obj, raw_state=raw_state):
|
||||
return True
|
||||
return False
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue