Изменен фильтр на State. Вместо == теперь in. Работает если в хендлере указано несколько фильтров на State
This commit is contained in:
parent
103535d3ba
commit
a653ed6792
@ -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()
|
||||
|
||||
|
@ -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):
|
||||
|
Loading…
x
Reference in New Issue
Block a user