bot: check if plugins have their dependencies met

This commit is contained in:
dece 2020-10-09 13:30:28 +02:00
parent 4bbe0d1c79
commit dca201cbc1

View file

@ -73,6 +73,10 @@ class Bot(irc.client.SimpleIRCClient, Logger):
)
for plugin_name in plugin_names:
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"
plugin_class = getattr(module, class_name)
self.plugins.append(plugin_class(self))