plugin: clean

This commit is contained in:
dece 2020-11-05 22:45:33 +01:00
parent 06dfb99635
commit bc8cf0e465

View file

@ -125,9 +125,9 @@ class Plugin:
someone saying a bot's name. In other cases, return None. someone saying a bot's name. In other cases, return None.
Note that you do not need to use this method for command/question Note that you do not need to use this method for command/question
plugins, the following methods already check for this and do more plugins, the next methods already check for this and do more precise
precise parsing of the message. This is rather for plugins reacting to a parsing of the message. This is rather for plugins reacting to a message
message addressed to the bot that are neither commands or questions. addressed to the bot that are neither commands or questions.
""" """
first_word_and_rest = message.split(maxsplit=1) first_word_and_rest = message.split(maxsplit=1)
num_parts = len(first_word_and_rest) num_parts = len(first_word_and_rest)
@ -253,6 +253,11 @@ class Plugin:
content = " ".join(words[2:-1]) content = " ".join(words[2:-1])
return Command(ident, content, raw) return Command(ident, content, raw)
def __save_command(self, command):
"""Save command in instance for further processing by the plugin."""
self.command = command
self.bot.log_d(f"Processing command from plugin {self.name}: {command}")
def __respects_handling_conditions(self, exclude_conditions=None): def __respects_handling_conditions(self, exclude_conditions=None):
"""Check if question conditions are valid.""" """Check if question conditions are valid."""
conditions = self.config.get("handling_conditions", {}) conditions = self.config.get("handling_conditions", {})
@ -268,11 +273,6 @@ class Plugin:
return False return False
return True return True
def __save_command(self, command):
"""Save command in instance for further processing by the plugin."""
self.command = command
self.bot.log_d(f"Processing command from plugin {self.name}: {command}")
def signal_failure(self, target): def signal_failure(self, target):
"""Signal a plugin failure to target.""" """Signal a plugin failure to target."""
self.bot.say(target, self.bot.config["error_message"]) self.bot.say(target, self.bot.config["error_message"])