From 2719733a9c4c2d0464265dbafc2c2f1aeb984720 Mon Sep 17 00:00:00 2001 From: goberinfinity Date: Mon, 10 Oct 2022 21:18:57 -0700 Subject: [PATCH] Fix problem with relative path --- otter_welcome_buddy/startup/cogs.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/otter_welcome_buddy/startup/cogs.py b/otter_welcome_buddy/startup/cogs.py index 7809c17..194baa2 100644 --- a/otter_welcome_buddy/startup/cogs.py +++ b/otter_welcome_buddy/startup/cogs.py @@ -6,7 +6,7 @@ def __format_module_path_into_cog_extension(absolute_module_path: str) -> str: """Transforms absolute module path into ..""" module_absolute_path_no_extension: str = absolute_module_path[:-3] - module_relative_path: list[str] = module_absolute_path_no_extension.split("/")[-3:] + module_relative_path: list[str] = module_absolute_path_no_extension.split("/")[-2:] return ".".join(module_relative_path) @@ -17,7 +17,6 @@ async def register_cogs(bot: Bot) -> None: ] for cog in allowed_cogs: - pass # __file__ stores absolute path - # cog_extension = __format_module_path_into_cog_extension(cog.__file__) - # await bot.load_extension(cog_extension) + cog_extension = __format_module_path_into_cog_extension(cog.__file__) + await bot.load_extension(cog_extension)