From 546ffa953628adcd57858229df5d313db30e8c80 Mon Sep 17 00:00:00 2001 From: Oleg Matviichuk Date: Wed, 30 Jul 2025 00:20:06 +0200 Subject: [PATCH] Add get_state --- aiogram/fsm/storage/sqlite.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/aiogram/fsm/storage/sqlite.py b/aiogram/fsm/storage/sqlite.py index 4b0392b4..65d8e367 100644 --- a/aiogram/fsm/storage/sqlite.py +++ b/aiogram/fsm/storage/sqlite.py @@ -74,7 +74,17 @@ class SqliteStorage(BaseStorage): await self._connection.commit() async def get_state(self, key: StorageKey) -> Optional[str]: - pass + id = self._key_builder.build(key) + + cursor = await self._connection.execute( + f"""SELECT state + FROM aiogram_fsm + WHERE id = ?""", + (id), + ) + + row = await cursor.fetchone() + return row[0] if row else None async def set_data(self, key: StorageKey, data: Mapping[str, Any]) -> None: pass