plugins: fix on_pubmsg return values
This commit is contained in:
parent
7f75b15207
commit
937c5ad203
|
@ -31,22 +31,21 @@ class MusicPlugin(Plugin):
|
||||||
|
|
||||||
if self.command.ident == self.config["commands"][0]:
|
if self.command.ident == self.config["commands"][0]:
|
||||||
decade = random.choice(self.DECADES)
|
decade = random.choice(self.DECADES)
|
||||||
return self.tell_album_from_decade(event.target, decade)
|
self.tell_album_from_decade(event.target, decade)
|
||||||
elif self.command.ident == self.config["commands"][1]:
|
elif self.command.ident == self.config["commands"][1]:
|
||||||
decade = self.parse_decade(self.command.content)
|
decade = self.parse_decade(self.command.content)
|
||||||
if decade is None:
|
if decade is None:
|
||||||
self.signal_failure(event.target)
|
self.signal_failure(event.target)
|
||||||
return False
|
else:
|
||||||
return self.tell_album_from_decade(event.target, decade)
|
self.tell_album_from_decade(event.target, decade)
|
||||||
return False
|
return True
|
||||||
|
|
||||||
def tell_album_from_decade(self, target, decade):
|
def tell_album_from_decade(self, target, decade):
|
||||||
album = self.get_random_album(decade)
|
album = self.get_random_album(decade)
|
||||||
if not album:
|
if not album:
|
||||||
self.signal_failure(target)
|
self.signal_failure(target)
|
||||||
return False
|
return
|
||||||
self.bot.say(target, album)
|
self.bot.say(target, album)
|
||||||
return True
|
|
||||||
|
|
||||||
def get_random_album(self, decade):
|
def get_random_album(self, decade):
|
||||||
"""Return an album as str from this decade from Scaruffi website."""
|
"""Return an album as str from this decade from Scaruffi website."""
|
||||||
|
|
|
@ -26,3 +26,4 @@ class OpinionPlugin(Plugin):
|
||||||
reply_list = self.config["positive" if positive else "negative"]
|
reply_list = self.config["positive" if positive else "negative"]
|
||||||
reply = f"{content}... {random.choice(reply_list)}"
|
reply = f"{content}... {random.choice(reply_list)}"
|
||||||
self.bot.say(event.target, reply)
|
self.bot.say(event.target, reply)
|
||||||
|
return True
|
||||||
|
|
|
@ -20,3 +20,4 @@ class RandomPlugin(Plugin):
|
||||||
choice = random.choice(choices)
|
choice = random.choice(choices)
|
||||||
if choice:
|
if choice:
|
||||||
self.bot.say(event.target, choice)
|
self.bot.say(event.target, choice)
|
||||||
|
return True
|
||||||
|
|
|
@ -22,10 +22,12 @@ class TranslatePlugin(Plugin):
|
||||||
|
|
||||||
text = self.command.content
|
text = self.command.content
|
||||||
if not text:
|
if not text:
|
||||||
return False
|
self.signal_failure(event.target)
|
||||||
|
return True
|
||||||
words = text.split()
|
words = text.split()
|
||||||
if len(words) == 0:
|
if len(words) == 0:
|
||||||
return False
|
self.signal_failure(event.target)
|
||||||
|
return True
|
||||||
|
|
||||||
from_lang, to_lang, text = self.parse_words(words)
|
from_lang, to_lang, text = self.parse_words(words)
|
||||||
self.bot.log_d(f"Translating '{text}' from {from_lang} to {to_lang}.")
|
self.bot.log_d(f"Translating '{text}' from {from_lang} to {to_lang}.")
|
||||||
|
|
|
@ -36,7 +36,8 @@ class UnknownCommandPlugin(Plugin):
|
||||||
return False
|
return False
|
||||||
words = message.split()
|
words = message.split()
|
||||||
if len(words) == 0 or words[-1] != self.config["command_suffix"]:
|
if len(words) == 0 or words[-1] != self.config["command_suffix"]:
|
||||||
return False
|
self.signal_failure(event.target)
|
||||||
|
return True
|
||||||
|
|
||||||
query = " ".join(words[:-1])
|
query = " ".join(words[:-1])
|
||||||
self.process_query(query, event.target)
|
self.process_query(query, event.target)
|
||||||
|
|
Loading…
Reference in a new issue