From b920fe9325f30402884ad6877c0710974f937e02 Mon Sep 17 00:00:00 2001 From: wonkagrid Date: Mon, 1 Apr 2024 12:31:04 +0300 Subject: [PATCH 1/2] Add function get_value to FSMContext --- aiogram/fsm/context.py | 3 +++ 1 file changed, 3 insertions(+) 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]: From b76b7a67e8ee4b9734c62529b1bd1ff9b7589a44 Mon Sep 17 00:00:00 2001 From: wonkagrid Date: Mon, 1 Apr 2024 12:40:20 +0300 Subject: [PATCH 2/2] added_get_value.rst --- CHANGES/1431.feature.rst | 1 + 1 file changed, 1 insertion(+) create mode 100644 CHANGES/1431.feature.rst 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