From 2215df7a0f0332494ee8d014453dd63c54992f2e Mon Sep 17 00:00:00 2001 From: JRoot Junior Date: Wed, 14 Aug 2024 02:09:31 +0300 Subject: [PATCH] Added FSMStrategy to the documentation --- aiogram/fsm/strategy.py | 9 +++++++++ docs/dispatcher/finite_state_machine/index.rst | 1 + docs/dispatcher/finite_state_machine/strategy.rst | 9 +++++++++ docs/dispatcher/index.rst | 2 +- 4 files changed, 20 insertions(+), 1 deletion(-) create mode 100644 docs/dispatcher/finite_state_machine/strategy.rst diff --git a/aiogram/fsm/strategy.py b/aiogram/fsm/strategy.py index f68aa045..da2d94e7 100644 --- a/aiogram/fsm/strategy.py +++ b/aiogram/fsm/strategy.py @@ -3,11 +3,20 @@ from typing import Optional, Tuple class FSMStrategy(Enum): + """ + FSM strategy for storage key generation. + """ + USER_IN_CHAT = auto() + """State will be stored for each user in chat.""" CHAT = auto() + """State will be stored for each chat globally without separating by users.""" GLOBAL_USER = auto() + """State will be stored globally for each user globally.""" USER_IN_TOPIC = auto() + """State will be stored for each user in chat and topic.""" CHAT_TOPIC = auto() + """State will be stored for each chat and topic, but not separated by users.""" def apply_strategy( diff --git a/docs/dispatcher/finite_state_machine/index.rst b/docs/dispatcher/finite_state_machine/index.rst index d14f282f..ab07084c 100644 --- a/docs/dispatcher/finite_state_machine/index.rst +++ b/docs/dispatcher/finite_state_machine/index.rst @@ -95,6 +95,7 @@ Read more .. toctree:: storages + strategy scene diff --git a/docs/dispatcher/finite_state_machine/strategy.rst b/docs/dispatcher/finite_state_machine/strategy.rst new file mode 100644 index 00000000..3dcc4050 --- /dev/null +++ b/docs/dispatcher/finite_state_machine/strategy.rst @@ -0,0 +1,9 @@ +======== +Strategy +======== + +This module provides the `FSMStrategy` enumeration which is used to define the strategy of the finite state machine. + + +.. autoclass:: aiogram.fsm.strategy.FSMStrategy + :members: diff --git a/docs/dispatcher/index.rst b/docs/dispatcher/index.rst index daf7e1e5..6832380c 100644 --- a/docs/dispatcher/index.rst +++ b/docs/dispatcher/index.rst @@ -29,9 +29,9 @@ So, you can use both of them with *aiogram*. dependency_injection filters/index long_polling - webhook finite_state_machine/index middlewares errors flags + webhook class_based_handlers/index