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]:
|
||||
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]:
|
||||
decade = self.parse_decade(self.command.content)
|
||||
if decade is None:
|
||||
self.signal_failure(event.target)
|
||||
return False
|
||||
return self.tell_album_from_decade(event.target, decade)
|
||||
return False
|
||||
else:
|
||||
self.tell_album_from_decade(event.target, decade)
|
||||
return True
|
||||
|
||||
def tell_album_from_decade(self, target, decade):
|
||||
album = self.get_random_album(decade)
|
||||
if not album:
|
||||
self.signal_failure(target)
|
||||
return False
|
||||
return
|
||||
self.bot.say(target, album)
|
||||
return True
|
||||
|
||||
def get_random_album(self, decade):
|
||||
"""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 = f"{content}... {random.choice(reply_list)}"
|
||||
self.bot.say(event.target, reply)
|
||||
return True
|
||||
|
|
|
@ -20,3 +20,4 @@ class RandomPlugin(Plugin):
|
|||
choice = random.choice(choices)
|
||||
if choice:
|
||||
self.bot.say(event.target, choice)
|
||||
return True
|
||||
|
|
|
@ -22,10 +22,12 @@ class TranslatePlugin(Plugin):
|
|||
|
||||
text = self.command.content
|
||||
if not text:
|
||||
return False
|
||||
self.signal_failure(event.target)
|
||||
return True
|
||||
words = text.split()
|
||||
if len(words) == 0:
|
||||
return False
|
||||
self.signal_failure(event.target)
|
||||
return True
|
||||
|
||||
from_lang, to_lang, text = self.parse_words(words)
|
||||
self.bot.log_d(f"Translating '{text}' from {from_lang} to {to_lang}.")
|
||||
|
|
|
@ -36,7 +36,8 @@ class UnknownCommandPlugin(Plugin):
|
|||
return False
|
||||
words = message.split()
|
||||
if len(words) == 0 or words[-1] != self.config["command_suffix"]:
|
||||
return False
|
||||
self.signal_failure(event.target)
|
||||
return True
|
||||
|
||||
query = " ".join(words[:-1])
|
||||
self.process_query(query, event.target)
|
||||
|
|
Loading…
Reference in a new issue