unknown_question: fix usage of misc_reactions

This commit is contained in:
dece 2020-11-06 12:24:28 +01:00
parent 806ef07e0c
commit 16d0df2a44
2 changed files with 10 additions and 7 deletions

View file

@ -58,13 +58,16 @@ class MiscReactionsPlugin(Plugin):
def on_pubmsg(self, event):
if proc(self.config["rate"]):
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)
return True
return False
def react_with_sentence(self, event):
"""React with a random sentence from config list."""

View file

@ -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