plugin: minor fixes

master
dece 4 years ago
parent dca201cbc1
commit daab101a66

@ -23,7 +23,7 @@ class Plugin:
def get_config(self):
"""Return the plugin section from the bot config, plus common values."""
plugins_configs = self.bot.config["plugins"]
config = plugins_configs["common"]
config = plugins_configs["common"].copy()
config.update(plugins_configs.get(self.name, {}))
return config
@ -34,7 +34,7 @@ class Plugin:
if key not in self.config:
self.bot.log_w(f"Missing '{key}' in {self.name} configuration.")
missing = True
return missing
return not missing
def get_runtime_value(self, key, ns=None):
"""Get a value from the plugin runtime dict."""
@ -56,6 +56,7 @@ class Plugin:
for q in self.config.get("questions", []):
if question.startswith(q):
self.question = Question(q, question[len(q):].strip())
self.bot.log_d(f"Answering question from plugin {self.name}.")
return True
return False
@ -65,6 +66,7 @@ class Plugin:
commands = self.config.get("commands", [])
if command and any(c == command.ident for c in commands):
self.command = command
self.bot.log_d(f"Processing command from plugin {self.name}.")
return True
return False

Loading…
Cancel
Save