raito.plugins.scenes.registry module¶
- class raito.plugins.scenes.registry.SceneRegistry(scene, observer, name, middleware)[исходный код]¶
Базовые классы:
objectRegisters a scene’s handlers for one aiogram event type.
A scene exposes one of these per event as
scene.on_message,scene.on_callback_query, andscene.on_edited_message. Call it with a step’s state to handle that step, useany()for a handler that runs on every step, or useenter()to start the scene. ItsSceneMiddlewareis installed on the observer only when the first handler is added, so an event type without scene handlers is never touched.- Параметры:
scene (SceneManager[Any])
observer (TelegramEventObserver)
name (str)
middleware (SceneMiddleware)
- any(*filters)[исходный код]¶
Register a handler that runs on any active step of this scene.
Useful for something that should work no matter where the user is in the dialog, e.g. a
/cancelcommand or a persistent «Cancel» button:@mute.on_message.any(filters.Command("cancel")) async def cancel_anywhere(scene: Scene[MuteData]) -> None: await scene.cancel()
- Параметры:
filters (CallbackType) – filters applied on top of «any step of this scene»
- Результат:
decorator for the handler
- Тип результата:
Callable[[CallbackType], CallbackType]
- enter(*filters)[исходный код]¶
Register a handler that starts the scene from a fresh draft.
- Параметры:
filters (CallbackType) – filters that trigger the scene, e.g.
Command("mute")- Результат:
decorator for the entry handler
- Тип результата:
Callable[[CallbackType], CallbackType]