X-Git-Url: http://gitweb.pimeys.fr/?p=bots%2Fparrot.git;a=blobdiff_plain;f=parrot.py;h=d3039a4a432711ec2c4a79683e03a184a84d1df2;hp=17d99c199e9dc70a50ff735ed9aa5e0707cc551b;hb=a140e55d58b6af4b50c1cd83a78aa387f78e1a80;hpb=cf0848cb22e2dcf42846ce2d92b182b166e5fc59 diff --git a/parrot.py b/parrot.py index 17d99c1..d3039a4 100755 --- a/parrot.py +++ b/parrot.py @@ -446,6 +446,15 @@ class Parrot(ircbot.SingleServerIRCBot): serv.privmsg(canal, (u"Pas de quote de %s en mémoire." % author).encode("utf-8")) return serv.privmsg(canal, str(q)) + elif message.startswith(u"!author"): + words = message.split() + cmd = words[0].lstrip("!") + regexp = cmd in ["author-r", "authorreg", "author-reg", "author-regex"]: + search = u" ".join(words[1:]) + 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"))) def on_action(self, serv, ev): """À la réception d'une action."""