Skip to content

Commit

Permalink
Fix problem with relative path (#11)
Browse files Browse the repository at this point in the history
  • Loading branch information
GoberInfinity authored Oct 11, 2022
1 parent e71ea83 commit fcb1d61
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions otter_welcome_buddy/startup/cogs.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
def __format_module_path_into_cog_extension(absolute_module_path: str) -> str:
"""Transforms absolute module path into <base_path>.<cog_path>.<file>"""
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)


Expand All @@ -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)

0 comments on commit fcb1d61

Please sign in to comment.