Skip to content

The load_extensions function is not working correctly #1177

Open
@BazZziliuS

Description

@BazZziliuS

Summary

She misidentifies the audience

Reproduction Steps

image
image

Minimal Reproducible Code

# Dont work
class CenturyBOT(commands.InteractionBot):
    def __init__(self) -> None:
        super().__init__(intents=disnake.Intents.all(), owner_id=347880706724069376)
        self.load_extensions('./module')

if __name__ == "__main__":
    load_dotenv(os.path.join(os.path.dirname(__file__), 'data', '.env'))
    bot = CenturyBOT()
    bot.run(os.getenv("BOT_TOKEN"))


# Work
class CenturyBOT(commands.InteractionBot):
    def __init__(self) -> None:
        super().__init__(intents=disnake.Intents.all(), owner_id=347880706724069376)
        for filename in os.listdir('./centurybot/module'):
            if filename.endswith('.py') and filename != '__init__.py':
                self.load_extension(f'module.{filename[:-3]}')

if __name__ == "__main__":
    load_dotenv(os.path.join(os.path.dirname(__file__), 'data', '.env'))
    bot = CenturyBOT()
    bot.run(os.getenv("BOT_TOKEN"))

Expected Results

I expected cogs to run without a loop for

Actual Results

Mistake

Intents

disnake.Intents.all()

System Information

- Python v3.11.6-final
- disnake v2.9.1-final
    - disnake importlib.metadata: v2.9.1
- aiohttp v3.9.0
- system info: Windows 10 10.0.22621 AMD64

Checklist

  • I have searched the open issues for duplicates.
  • I have shown the entire traceback, if possible.
  • I have removed my token from display, if visible.

Additional Context

https://discord.com/channels/808030843078836254/1220966362747244555/1221327569585176606
No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions