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