Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix problem with relative path #11

Merged
merged 1 commit into from
Oct 11, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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)