fix: Update cog loading mechanism to load specific cogs only
This commit is contained in:
parent
121fac424a
commit
429d9525ba
@ -147,7 +147,7 @@ python api_service/api_server.py
|
|||||||
- Default prefix: `!` (same as main bot)
|
- Default prefix: `!` (same as main bot)
|
||||||
- Uses global command syncing instead of per-guild
|
- Uses global command syncing instead of per-guild
|
||||||
- All commands work in DMs and private channels
|
- All commands work in DMs and private channels
|
||||||
- Identical functionality to main bot but with different command registration
|
- Loads only a limited set of cogs (settings, help, message, webdrivertorso, owoify, safebooru, rule34, starboard, wordle)
|
||||||
|
|
||||||
## 🧩 Project Structure
|
## 🧩 Project Structure
|
||||||
|
|
||||||
|
28
neru_bot.py
28
neru_bot.py
@ -7,7 +7,6 @@ import asyncio
|
|||||||
import logging
|
import logging
|
||||||
import asyncpg
|
import asyncpg
|
||||||
import redis.asyncio as aioredis
|
import redis.asyncio as aioredis
|
||||||
from commands import load_all_cogs
|
|
||||||
from error_handler import handle_error
|
from error_handler import handle_error
|
||||||
import settings_manager
|
import settings_manager
|
||||||
from global_bot_accessor import set_bot_instance
|
from global_bot_accessor import set_bot_instance
|
||||||
@ -84,12 +83,31 @@ class NeruBot(commands.Bot):
|
|||||||
else:
|
else:
|
||||||
log.error("CRITICAL: pg_pool or redis_client not initialized in setup_hook. Cannot proceed with settings_manager setup.")
|
log.error("CRITICAL: pg_pool or redis_client not initialized in setup_hook. Cannot proceed with settings_manager setup.")
|
||||||
|
|
||||||
# Load all cogs
|
# Load only specific cogs
|
||||||
try:
|
try:
|
||||||
await load_all_cogs(self)
|
# Define the hardcoded list of cogs to load
|
||||||
log.info("All cogs loaded successfully")
|
hardcoded_cogs = [
|
||||||
|
"cogs.settings_cog",
|
||||||
|
"cogs.help_cog",
|
||||||
|
"cogs.message_cog",
|
||||||
|
"cogs.owoify_cog",
|
||||||
|
"cogs.safebooru_cog",
|
||||||
|
"cogs.caption_cog",
|
||||||
|
"cogs.games_cog",
|
||||||
|
"cogs.ping_cog",
|
||||||
|
]
|
||||||
|
|
||||||
|
# Load each cog individually
|
||||||
|
for cog in hardcoded_cogs:
|
||||||
|
try:
|
||||||
|
await self.load_extension(cog)
|
||||||
|
log.info(f"Successfully loaded {cog}")
|
||||||
|
except Exception as e:
|
||||||
|
log.exception(f"Error loading cog {cog}: {e}")
|
||||||
|
|
||||||
|
log.info(f"Loaded {len(hardcoded_cogs)} hardcoded cogs")
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
log.exception(f"Error loading cogs: {e}")
|
log.exception(f"Error during cog loading process: {e}")
|
||||||
|
|
||||||
# Apply global allowed_installs and allowed_contexts to all commands
|
# Apply global allowed_installs and allowed_contexts to all commands
|
||||||
try:
|
try:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user