Observer is used for filtering and handling different events. That is part of internal API with some public methods and is recommended to don't use methods is not listed here.
aiogram framework is available two variants of observer:
That is base observer for all events.
Base registering method¶
Will return original callback.
Decorator-style registering method¶
@<observer>() async def handler(*args, **kwargs): pass
Is subclass of EventObserver with some differences. Here you can register handler with filters or bounded filters which can be used as keyword arguments instead of writing full references when you register new handlers. This observer will stops event propagation when first handler is pass.
Registering bound filters¶
Bound filter should be subclass of BaseFilter
TelegramEventObserver.register(callback, filter1, filter2, ..., bound_filter=value, ...)
In this method is added bound filters keywords interface.
||Ordered filters set|
Decorator-style registering event handler with filters¶
@<observer>(filter1, filter2, ...) async def handler(*args, **kwargs): pass