raito.plugins.scenes.steps module¶
- class raito.plugins.scenes.steps.SceneSteps(states)[source]¶
Bases:
objectThe ordered steps of a scene, derived from an aiogram
StatesGroup.Owns everything about the step layout — the order used by
scene.nextandscene.back, the membership checks that detect a stale scene, and the namespace prefix that tells a scene’s own states apart from anything else in FSM storage.- Parameters:
states (object)
- ensure(state)[source]¶
Validate that
stateis a step of this scene.- Parameters:
state (State) – state to check
- Raises:
ValueError – if
stateis not one of the scene’s steps- Return type:
None
- step_for(raw_state)[source]¶
Return the step matching
raw_state.Trusts that
raw_stateis already an active step of this scene — theStateFilterthat matched the handler already established that.- Parameters:
raw_state (str) – state aiogram already resolved for this update
- Returns:
the matching step
- Return type:
State
- after(step)[source]¶
Return the step following
step(the first step, from entry).- Parameters:
step (State | None) – current step, or
Noneat entry- Returns:
next step in declaration order
- Raises:
RuntimeError – if
stepis already the last step- Return type:
State
- before(step)[source]¶
Return the step preceding
step.- Parameters:
step (State | None) – current step
- Returns:
previous step in declaration order
- Raises:
RuntimeError – if there is no earlier step
- Return type:
State