multiple-changes-made

This commit is contained in:
eweeman
2026-01-14 11:44:13 -08:00
parent 9d31399518
commit 9de6602e0d
39 changed files with 806 additions and 66 deletions

35
bot_loader.py Normal file
View File

@@ -0,0 +1,35 @@
import importlib
import logging
from pathlib import Path
def load_bots(bots_path: Path):
bots = {}
for file in bots_path.glob("*.py"):
if file.name.startswith("_"):
continue
# Skip files that are clearly tools, not bot profiles
if file.name.endswith("_tool.py"):
logging.info(f"Skipping tool file in bots directory: {file.name}")
continue
module_name = f"bots.{file.stem}"
try:
module = importlib.import_module(module_name)
# Check if BOT_IDENTIFIER exists
if not hasattr(module, "BOT_IDENTIFIER"):
logging.warning(f"Bot {file.name} missing BOT_IDENTIFIER, skipping")
continue
identifier = module.BOT_IDENTIFIER
bots[identifier] = module
logging.info(f"Loaded bot profile: {identifier}")
except Exception:
logging.error(f"Failed to load bot {file.name}", exc_info=True)
return bots