From: Vincent Le Gallic Date: Mon, 14 Apr 2014 06:58:04 +0000 (+0200) Subject: !author : on affiche un message si pas de résultat X-Git-Url: http://gitweb.pimeys.fr/?p=bots%2Fparrot.git;a=commitdiff_plain;h=9cdf643cd7cb6713b470f54a09f963816101fca0 !author : on affiche un message si pas de résultat --- diff --git a/parrot.py b/parrot.py index aae04fc..6229e8d 100755 --- a/parrot.py +++ b/parrot.py @@ -454,7 +454,10 @@ class Parrot(ircbot.SingleServerIRCBot): authors = self.quotedb.search_authors(search, regexp) if len(authors) > config.search_max_authors: authors = authors[:config.search_max_authors+1] + [unicode(len(authors) - config.search_max_authors)] - serv.privmsg(canal, "%s: %s" % (auteur, (u" ".join(authors)).encode("utf-8"))) + if authors: + serv.privmsg(canal, "%s: %s" % (auteur, (u" ".join(authors)).encode("utf-8"))) + else: + serv.privmsg(canal, "%s: Pas d'auteur correspondant à la recherche.") def on_action(self, serv, ev): """À la réception d'une action."""