diff --git a/pybot-f.py b/pybot-f.py index 24f9f32..32f89f7 100644 --- a/pybot-f.py +++ b/pybot-f.py @@ -77,15 +77,11 @@ async def sync(ctx: commands.Context, guilds: commands.Greedy[discord.Object], # loading extensions ... +# TODO: Test this. async def scanext(): - with os.scandir('./ext/') as dirs: - for entry in dirs: - if entry.name.endswith('.py'): - try: - print(f"Loading extension: {entry.name}") - await bot.load_extension('ext.' + os.path.splitext(entry.name)[0]) - except Exception as error: - print(f'Error loading {entry.name}: {error}') + for filename in os.listdir("./ext"): + if filename.endswith(".py"): + await bot.load_extension(f"ext.{filename[:-3]}") async def main():