Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
bot, plugins: fix per-channel configuration by plugin name
When this feature was first implemented, core plugins and user plugins (from `~/.sopel/modules`) both loaded in a similar way. Their Python module names matched the file names, and nobody thought to test how this feature worked (or might not) for `sopel_modules` packages. Certainly, no one thought to test entry-point plugins (new in 7.0, implemented *after* this was). To make a long story short (the full narrative is summarized in #1839), this feature was never going to work as intended in all cases. Changes to the plugin machinery simply made it *also* not work for core plugins, which made the shortcomings of its implementation much more obvious. Before passing the module contents back to `bot` during registration, the `plugins.handlers.PyModulePlugin` class (and derivatives) now adds a `plugin_name` attribute to each "relevant part" (callable). This is immediately useful for improving the per-channel filtering so it works as expected, and will likely find more use in the future (e.g. as a substitute for the long-deprecated `bot.command_groups` property). In `bot`, in addition to using the new callable attribute instead of Python's module name for per-channel filtering, I also added log output to debug mode for completeness.
- Loading branch information