mirror of
https://github.com/aiogram/aiogram.git
synced 2026-04-08 16:37:47 +00:00
Add motor module check and error message
Signed-off-by: selfkilla666 <selfkilla666@yahoo.com>
This commit is contained in:
parent
21a1906dba
commit
a7b1dff425
1 changed files with 9 additions and 3 deletions
|
|
@ -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"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue