From d8f25a4cab028d43f815c7bb3337ef53eca204d4 Mon Sep 17 00:00:00 2001 From: Vincent Le Gallic Date: Mon, 14 Apr 2014 09:12:34 +0200 Subject: [PATCH] =?utf8?q?-r=20-reg=20etc=E2=80=A6=20dans=20la=20conf?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- config.py | 3 +++ parrot.py | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) 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: -- 2.39.2