X-Git-Url: http://gitweb.pimeys.fr/?p=bots%2Fparrot.git;a=blobdiff_plain;f=parrot.py;fp=parrot.py;h=955f3f7307399c725b33a397c75b4c097bbd517e;hp=e9f4637b626d1d20a99fa6618f6afa095ba948c0;hb=1c3064ae51849a028ac4d0b4c05af0c7df5ea4d9;hpb=5a141999c786c7206cd487d988e0f81c55c6eb32 diff --git a/parrot.py b/parrot.py index e9f4637..955f3f7 100755 --- a/parrot.py +++ b/parrot.py @@ -481,6 +481,11 @@ class Parrot(ircbot.SingleServerIRCBot): regexp = cmd in ["search" + suffix for suffix in config.regex_suffixes] search = u" ".join(words[1:]) quotes = self.quotedb.search(inquote=search, regexp=regexp) + # On recherche également sur le contexte si on est en !context-search + if show_context: + quotes += self.quotedb.search(place=search, regexp=regexp) + # Pour pas biaiser le choix aléatoire, on enlève les doublons + quotes = list(set(quotes)) if quotes: q = random.choice(quotes) serv.privmsg(canal, q.display(show_context))