bot: support plugins names with multiples words
This commit is contained in:
parent
74343e2a24
commit
9ab1812938
|
@ -77,7 +77,11 @@ class Bot(irc.client.SimpleIRCClient, Logger):
|
||||||
if not are_dependencies_ok:
|
if not are_dependencies_ok:
|
||||||
self.log_e(f"Dependencies not found for plugin {plugin_name}.")
|
self.log_e(f"Dependencies not found for plugin {plugin_name}.")
|
||||||
continue
|
continue
|
||||||
class_name = plugin_name.capitalize() + "Plugin"
|
# Get plugin class name from its module name.
|
||||||
|
class_name = "".join(map(
|
||||||
|
lambda w: w.capitalize(),
|
||||||
|
plugin_name.split("_")
|
||||||
|
)) + "Plugin"
|
||||||
plugin_class = getattr(module, class_name)
|
plugin_class = getattr(module, class_name)
|
||||||
self.plugins.append(plugin_class(self))
|
self.plugins.append(plugin_class(self))
|
||||||
self.values[plugin_name] = {}
|
self.values[plugin_name] = {}
|
||||||
|
|
Loading…
Reference in a new issue