Refactor database path resolution in cogs and improve cog loading error handling. Update database connections in Giveaway, Nightmode, and Owner cogs to use a centralized path resolver. Enhance cog loading feedback with success and failure messages.
This commit is contained in:
@@ -19,11 +19,10 @@ from utils.Tools import *
|
||||
from utils.cv2 import CV2
|
||||
from discord.ui import TextDisplay, Separator, ActionRow, LayoutView, Container
|
||||
from utils.config import OWNER_IDS_STR
|
||||
from utils.db_paths import db_path as resolve_db_path
|
||||
|
||||
# Database setup
|
||||
db_folder = "db"
|
||||
db_file = "anti.db"
|
||||
db_path = os.path.join(db_folder, db_file)
|
||||
nightmode_db_path = resolve_db_path("anti.db")
|
||||
|
||||
|
||||
class Nightmode(commands.Cog):
|
||||
@@ -34,7 +33,7 @@ class Nightmode(commands.Cog):
|
||||
self.color = 0xFF0000
|
||||
|
||||
async def initialize_db(self):
|
||||
self.db = await aiosqlite.connect(db_path)
|
||||
self.db = await aiosqlite.connect(nightmode_db_path)
|
||||
await self.db.execute("""
|
||||
CREATE TABLE IF NOT EXISTS Nightmode (
|
||||
guildId TEXT,
|
||||
|
||||
Reference in New Issue
Block a user