bot: check if plugins have their dependencies met
This commit is contained in:
parent
4bbe0d1c79
commit
dca201cbc1
|
@ -73,6 +73,10 @@ class Bot(irc.client.SimpleIRCClient, Logger):
|
||||||
)
|
)
|
||||||
for plugin_name in plugin_names:
|
for plugin_name in plugin_names:
|
||||||
module = importlib.import_module(f"edmond.plugins.{plugin_name}")
|
module = importlib.import_module(f"edmond.plugins.{plugin_name}")
|
||||||
|
are_dependencies_ok = getattr(module, "DEPENDENCIES_FOUND", True)
|
||||||
|
if not are_dependencies_ok:
|
||||||
|
self.log_e(f"Dependencies not found for plugin {plugin_name}.")
|
||||||
|
continue
|
||||||
class_name = plugin_name.capitalize() + "Plugin"
|
class_name = plugin_name.capitalize() + "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))
|
||||||
|
|
Loading…
Reference in a new issue