diff --git a/edmond/plugins/misc_reactions.py b/edmond/plugins/misc_reactions.py index 559a6ac..fe92a39 100644 --- a/edmond/plugins/misc_reactions.py +++ b/edmond/plugins/misc_reactions.py @@ -58,14 +58,17 @@ class MiscReactionsPlugin(Plugin): def on_pubmsg(self, event): if proc(self.config["rate"]): - if self.weights: - method = random.choices(self.reactions, self.weights)[0] - else: - method = random.choice(self.reactions) - method(event) + self.react(event) return True return False + def react(self, event): + if self.weights: + method = random.choices(self.reactions, self.weights)[0] + else: + method = random.choice(self.reactions) + method(event) + def react_with_sentence(self, event): """React with a random sentence from config list.""" sentences = self.config.get("sentences") diff --git a/edmond/plugins/unknown_question.py b/edmond/plugins/unknown_question.py index 7a6b323..61aff05 100644 --- a/edmond/plugins/unknown_question.py +++ b/edmond/plugins/unknown_question.py @@ -26,7 +26,7 @@ class UnknownQuestionPlugin(Plugin): if message is None: return False if self.misc_plugin and proc(self.config["pass_to_misc_rate"]): - return self.misc_plugin.on_pubmsg(event) + self.misc_plugin.react(event) else: self.bot.say(event.target, "?" * random.randint(1, 3)) - return True + return True