State Managers
A generic menu state manager.
If specified user does not exist, create them and return True.
- Parameters
user_id (
Optional[int]) – A value used to identify the user.- Return type
bool- Returns
True if user was successfully created.
Get the current state for specified user.
- Parameters
user_id (
Optional[int]) – A value used to identify the user.- Return type
str- Returns
The current state for specified user.
Return to the one of previous states.
- Parameters
user_id (
Optional[int]) – A value used to identify the user.count (
Optional[int]) – How many steps to go back.
- Return type
None
Set the current state for specified user.
- Parameters
user_id (
Optional[int]) – A value used to identify the user.new_state (
str) – A state to set.
- Return type
None
Bases:
navmenu.state.StateHandlerA menu state manager that uses a dictionary to store data.
- Parameters
default_state (
str) – The state that will be assigned to new users.
If specified user does not exist, create them and return True.
- Parameters
user_id (
Optional[int]) – A value used to identify the user.- Return type
bool- Returns
True if user was successfully created.
Get the current state for specified user.
- Parameters
user_id (
Optional[int]) – A value used to identify the user.- Return type
str- Returns
The current state for specified user.
Return to the one of previous states.
- Parameters
user_id (
Optional[int]) – A value used to identify the user.count (
Optional[int]) – How many steps to go back.
- Return type
None
Set the current state for specified user.
- Parameters
user_id (
Optional[int]) – A value used to identify the user.new_state (
str) – A state to set.
- Return type
None