diff --git a/CHANGES/1431.feature.rst b/CHANGES/1431.feature.rst new file mode 100644 index 00000000..0a4b8de1 --- /dev/null +++ b/CHANGES/1431.feature.rst @@ -0,0 +1 @@ +Added function **get_value** to **FSMContext** class method. \ No newline at end of file diff --git a/aiogram/fsm/context.py b/aiogram/fsm/context.py index 53a8ea46..bc5942ee 100644 --- a/aiogram/fsm/context.py +++ b/aiogram/fsm/context.py @@ -20,6 +20,9 @@ class FSMContext: async def get_data(self) -> Dict[str, Any]: return await self.storage.get_data(key=self.key) + async def get_value(self, value: str) -> Any: + return await self.get_data()[value] + async def update_data( self, data: Optional[Dict[str, Any]] = None, **kwargs: Any ) -> Dict[str, Any]: