Skip to content

Commit

Permalink
bot: fix plugin name in _command_groups
Browse files Browse the repository at this point in the history
The "_command_groups" attribute is used to generate the documentation
for plugin's command (there is an old piece of code for some
undocumented feature here but that's something else).

The problem is that it tries to derive the plugin's name from the Python
module the callable come from, instead of, you know, the actual plugin's
name.

Since we added the "plugin_name" attribute on all callable back in
8776354 (see sopel-irc#1840) we can now use it
safely for the command group.

One-line fix for you all!
  • Loading branch information
Exirel committed May 18, 2020
1 parent 5d819d7 commit 55a6881
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion sopel/bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -470,7 +470,7 @@ def register(self, callables, jobs, shutdowns, urls):
callable_name)

if commands:
plugin_name = callbl.__module__.rsplit('.', 1)[-1]
plugin_name = callbl.plugin_name
# TODO doc and make decorator for this. Not sure if this is how
# it should work yet, so not making it public for 6.0.
category = getattr(callbl, 'category', plugin_name)
Expand Down

0 comments on commit 55a6881

Please sign in to comment.