from pathlib import Path ROOT=Path(__file__).resolve().parent.parent async def load_all(bot): for d in ("cmds","events"): for f in sorted((ROOT/d).glob("*.py")): if f.name.startswith("_"):continue try:await bot.load_extension(f"{d}.{f.stem}") except Exception as e:bot.hook.put(f"module load failed: {d}.{f.stem}: {e!r}")