unknown_question: fix usage of misc_reactions
This commit is contained in:
parent
806ef07e0c
commit
16d0df2a44
|
@ -58,13 +58,16 @@ class MiscReactionsPlugin(Plugin):
|
||||||
|
|
||||||
def on_pubmsg(self, event):
|
def on_pubmsg(self, event):
|
||||||
if proc(self.config["rate"]):
|
if proc(self.config["rate"]):
|
||||||
|
self.react(event)
|
||||||
|
return True
|
||||||
|
return False
|
||||||
|
|
||||||
|
def react(self, event):
|
||||||
if self.weights:
|
if self.weights:
|
||||||
method = random.choices(self.reactions, self.weights)[0]
|
method = random.choices(self.reactions, self.weights)[0]
|
||||||
else:
|
else:
|
||||||
method = random.choice(self.reactions)
|
method = random.choice(self.reactions)
|
||||||
method(event)
|
method(event)
|
||||||
return True
|
|
||||||
return False
|
|
||||||
|
|
||||||
def react_with_sentence(self, event):
|
def react_with_sentence(self, event):
|
||||||
"""React with a random sentence from config list."""
|
"""React with a random sentence from config list."""
|
||||||
|
|
|
@ -26,7 +26,7 @@ class UnknownQuestionPlugin(Plugin):
|
||||||
if message is None:
|
if message is None:
|
||||||
return False
|
return False
|
||||||
if self.misc_plugin and proc(self.config["pass_to_misc_rate"]):
|
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:
|
else:
|
||||||
self.bot.say(event.target, "?" * random.randint(1, 3))
|
self.bot.say(event.target, "?" * random.randint(1, 3))
|
||||||
return True
|
return True
|
||||||
|
|
Loading…
Reference in a new issue