Add motor module check and error message

Signed-off-by: selfkilla666 <selfkilla666@yahoo.com>
This commit is contained in:
selfkilla666 2024-02-06 01:29:40 +02:00
parent 21a1906dba
commit a7b1dff425
No known key found for this signature in database
GPG key ID: 8E784F7D1611B14C

View file

@ -5,9 +5,15 @@ from aiogram.fsm.storage.base import BaseStorage
from aiogram.fsm.storage.base import StateType
from aiogram.fsm.storage.base import StorageKey
from motor.motor_asyncio import AsyncIOMotorClient
from motor.motor_asyncio import AsyncIOMotorDatabase
from motor.motor_asyncio import AsyncIOMotorCollection
try:
from motor.motor_asyncio import AsyncIOMotorClient
from motor.motor_asyncio import AsyncIOMotorDatabase
from motor.motor_asyncio import AsyncIOMotorCollection
except ImportError:
raise ModuleNotFoundError(
"You do not have the `motor` module installed to work with MongoDB. Install it with `pip install aiogram[mongo]`"
)
AIOGRAM_DATABASE_NAME: str = "aiogram-storage"
MONGODB_STATES_COLLECTION: str = "states"