diff --git a/maxapi/dispatcher.py b/maxapi/dispatcher.py index ce5403c..d46d990 100644 --- a/maxapi/dispatcher.py +++ b/maxapi/dispatcher.py @@ -240,9 +240,10 @@ class Dispatcher: if handler.filters: if not filter_attrs(event_object, *handler.filters): continue - - if not handler.state == current_state and handler.state: - continue + + if handler.states: + if current_state not in handler.states: + continue func_args = handler.func_event.__annotations__.keys() diff --git a/maxapi/filters/handler.py b/maxapi/filters/handler.py index 486a07a..f68e057 100644 --- a/maxapi/filters/handler.py +++ b/maxapi/filters/handler.py @@ -44,14 +44,14 @@ class Handler: self.func_event: Callable = func_event self.update_type: UpdateType = update_type self.filters = [] - self.state: Optional[State] = None + self.states: Optional[List[State]] = [] self.middlewares: List[BaseMiddleware] = [] for arg in args: if isinstance(arg, MagicFilter): self.filters.append(arg) elif isinstance(arg, State): - self.state = arg + self.states.append(arg) elif isinstance(arg, (Command, CommandStart)): self.filters.insert(0, F.message.body.text.split()[0] == arg.command) elif isinstance(arg, BaseMiddleware):