import motor.motor_asyncio import logging from config import MONGO_URI logging.basicConfig(level=logging.INFO) logger = logging.getLogger(__name__) class Database: def __init__(self, uri: str): self.client = motor.motor_asyncio.AsyncIOMotorClient(uri) self.db = self.client["Akeno"] self.antieval = self.db["antieval"] self.warns = self.db["warns"] async def connect(self): try: await self.client.admin.command("ping") logger.info("Connected to the database.") except Exception as e: logger.error(f"Error connecting to the database: {e}") async def close(self): await self.client.close() logger.info("Database connection closed.") db = Database(MONGO_URI)