Добавлены: билдер инлайн клавиатур, FSM like aiogram, start_polling и логгирование
This commit is contained in:
@@ -6,7 +6,7 @@ from magic_filter.operations.comparator import ComparatorOperation as mf_compara
|
||||
F = MagicFilter()
|
||||
|
||||
|
||||
def filter_m(obj, *magic_args):
|
||||
def filter_attrs(obj, *magic_args):
|
||||
try:
|
||||
for arg in magic_args:
|
||||
|
||||
|
31
maxapi/filters/handler.py
Normal file
31
maxapi/filters/handler.py
Normal file
@@ -0,0 +1,31 @@
|
||||
from typing import Callable
|
||||
|
||||
from magic_filter import F, MagicFilter
|
||||
|
||||
from ..types.command import Command
|
||||
from ..context.state_machine import State
|
||||
from ..enums.update import UpdateType
|
||||
|
||||
|
||||
class Handler:
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
*args,
|
||||
func_event: Callable,
|
||||
update_type: UpdateType,
|
||||
**kwargs
|
||||
):
|
||||
|
||||
self.func_event = func_event
|
||||
self.update_type = update_type
|
||||
self.filters = []
|
||||
self.state = None
|
||||
|
||||
for arg in args:
|
||||
if isinstance(arg, MagicFilter):
|
||||
self.filters.append(arg)
|
||||
elif isinstance(arg, State):
|
||||
self.state = arg
|
||||
elif isinstance(arg, Command):
|
||||
self.filters.insert(0, F.message.body.text == arg.command)
|
Reference in New Issue
Block a user