refactor: Bot.load_extensions rework - #796
Conversation
not really necessary since Iterator is covariant, but might as well do it anyway
|
Recently I've realized there are few ways of passing stuff around that doesn't involve slapping said stuff as bot attribute. |
That would be useful, yeah.
(created a thread here: https://canary.discord.com/channels/808030843078836254/1092780323307257906) |
Summary
This PR refactors
Bot.load_extensions, improving several aspects and hopefully making common patterns easier to use.Module discovery now works similar to
pkgutil.walk_packages.Initially I removed
utils.search_directoryentirely, but then opted to keep it for now and only deprecate it. While the transition toBot.find_extensions(or even justBot.load_extensions) should be trivial, having a deprecation period still won't hurt.It might look like a lot, but most of it is documentation and tests :p
Docs can be found here https://disnake--796.org.readthedocs.build/en/796/ext/commands/extensions.html#ext-commands-extensions-load.
related: #1132
TODO
Checklist
task linttask pyright