raito.core.routers.router module¶
- class raito.core.routers.router.Router(*, name=None, priority=0, autoload=True)[исходный код]¶
Базовые классы:
RouterAn expanded aiogram router implementation.
- on_pagination(name, *filters)[исходный код]¶
Register pagination handler for specific name.
- Параметры:
name (str) – pagination name
filters (CallbackType)
- Результат:
decorator function
- Тип результата:
CallbackType
- scene(states: type[StatesGroup]) SceneManager[SceneData][исходный код]¶
- scene(states: type[StatesGroup], *, data: type[TSceneData]) SceneManager[TSceneData]
Create a per-update dialog flow over an aiogram
StatesGroup.Every entry and step is registered as a regular message handler, so middleware dependencies — including database sessions — stay scoped to a single update and are released between steps.
- Параметры:
- Результат:
the scene, to attach handlers with
.enterand.on- Исключение:
ValueError – if the router already owns a scene for these states
- Тип результата:
SceneManager[Any]
- on_command_signature_error()[исходный код]¶
Called when the signature of an entered command is incorrect.
Пример
@router.on_command_signature_error() async def handler(event, command, params, description) -> None: await event.reply(get_command_help(command, params, description))
- lifespan()[исходный код]¶
Register a lifespan function for a given router, similar to FastAPI’s lifespan handler. The function must be an async generator: it runs setup before yield, and cleanup after.
- Тип результата:
Callable[[Callable[[…], AsyncGenerator[None, None]]], Callable[[…], AsyncGenerator[None, None]]]