]> gitweb.pimeys.fr Git - bots/parrot.git/commitdiff
!author : on affiche un message si pas de résultat
authorVincent Le Gallic <legallic@crans.org>
Mon, 14 Apr 2014 06:58:04 +0000 (08:58 +0200)
committerVincent Le Gallic <legallic@crans.org>
Mon, 14 Apr 2014 06:58:04 +0000 (08:58 +0200)
parrot.py

index aae04fc037e198f702e24d1d6c175d2a31f3f9d8..6229e8d4a5c4189d82a0a6945fe5d8c3a52e4e50 100755 (executable)
--- 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)]
                 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."""
 
     def on_action(self, serv, ev):
         """À la réception d'une action."""