Fix cog auto-load
All checks were successful
Build and Publish Jimmy.2 / build_and_publish (push) Successful in 6s

This commit is contained in:
Nexus 2024-04-29 01:42:02 +01:00
parent a44556626d
commit d98d6c6669
Signed by: nex
GPG key ID: 0FA334385D0B689F

View file

@ -121,7 +121,7 @@ bot = Client(
for module in CONFIG["jimmy"].get("modules", ["cogs/*.py"]):
try:
bot.load_extension(module)
except discord.ExtensionNotFound:
except (discord.ExtensionNotFound, ModuleNotFoundError):
log.debug("%r does not exist - trying as glob pattern", module)
for ext in glob.glob(module, recursive=True):
ext = ext.replace("/", ".")[:-3] # foo/bar.py -> foo.bar