From: Vincent Le Gallic Date: Mon, 14 Apr 2014 07:12:34 +0000 (+0200) Subject: -r -reg etc… dans la conf X-Git-Url: http://gitweb.pimeys.fr/?a=commitdiff_plain;h=d8f25a4cab028d43f815c7bb3337ef53eca204d4;p=bots%2Fparrot.git -r -reg etc… dans la conf --- diff --git a/config.py b/config.py index ab9e5de..a871d69 100644 --- a/config.py +++ b/config.py @@ -134,5 +134,8 @@ quote_dump_file = u"quotes.txt" #: URL où sont disponibles les quotes quote_display_url = u"http://cerebro.crans.org/parrot-quotes.txt (campus-only)" +#: Suffixes qui font qu'une commande va utiliser des regexp +regex_suffixes = ["-r", "reg", "-reg", "regex", "-regex", "regexp", "-regexp"] + #: Nombre maximum d'auteurs qu'on peut demander à afficher search_max_authors = 20 diff --git a/parrot.py b/parrot.py index 0c4006f..8214594 100755 --- a/parrot.py +++ b/parrot.py @@ -449,7 +449,7 @@ class Parrot(ircbot.SingleServerIRCBot): elif message.startswith(u"!author"): words = message.split() cmd = words[0].lstrip("!") - regexp = cmd in ["author-r", "authorreg", "author-reg", "author-regex"] + regexp = cmd in ["author" + suffix for suffix in config.regex_suffixes] search = u" ".join(words[1:]) authors = self.quotedb.search_authors(search, regexp) if len(authors) > config.search_max_authors: