From 1ca83f083f9222ff965154c82ff1390cb3937fc7 Mon Sep 17 00:00:00 2001 From: dsodx Date: Tue, 6 Jun 2023 09:46:49 +0300 Subject: [PATCH] Add note about `redis` package --- aiogram/fsm/storage/__init__.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/aiogram/fsm/storage/__init__.py b/aiogram/fsm/storage/__init__.py index 1b900380..372994bf 100644 --- a/aiogram/fsm/storage/__init__.py +++ b/aiogram/fsm/storage/__init__.py @@ -1,5 +1,3 @@ -from contextlib import suppress - from .base import BaseEventIsolation, BaseStorage, StorageKey from .memory import ( DisabledEventIsolation, @@ -8,8 +6,15 @@ from .memory import ( SimpleEventIsolation, ) -with suppress(ModuleNotFoundError): +try: from .redis import DefaultKeyBuilder, KeyBuilder, RedisEventIsolation, RedisStorage +except ModuleNotFoundError: + from aiogram import loggers + + loggers.dispatcher.warning( + msg="NOTE that Redis package should be installed to use RedisStorage" + ) + __all__ = ( "StorageKey",