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.
Some checks failed
CI / Bot (Python) (push) Successful in 12s
CI / Dashboard (Next.js) (push) Failing after 9s

This commit is contained in:
TheOnlyMace
2026-07-21 22:28:18 +02:00
parent 9006b06c09
commit 18ef29f777
6 changed files with 114 additions and 44 deletions

View File

@@ -192,8 +192,17 @@ COG_CLASSES: tuple[type, ...] = (
async def setup(bot: Axiom) -> None:
loaded = 0
for cog_cls in COG_CLASSES:
await bot.add_cog(cog_cls(bot))
print(Fore.RED + Style.BRIGHT + f"Loaded cog: {cog_cls.__name__}")
try:
await bot.add_cog(cog_cls(bot))
loaded += 1
print(Fore.GREEN + Style.BRIGHT + f"Loaded cog: {cog_cls.__name__}")
except Exception as e:
print(
Fore.RED
+ Style.BRIGHT
+ f"Failed cog {getattr(cog_cls, '__name__', cog_cls)}: {type(e).__name__}: {e}"
)
print(Fore.RED + Style.BRIGHT + f"All {BotName} Cogs loaded successfully.")
print(Fore.GREEN + Style.BRIGHT + f"Loaded {loaded}/{len(COG_CLASSES)} {BotName} cogs.")