From fd087472ed16a00627af6fd60ea1e8d06374bfe1 Mon Sep 17 00:00:00 2001 From: Vincent Le Gallic Date: Sat, 25 May 2013 23:03:26 +0200 Subject: [PATCH] jben is trying harder --- config.py | 1 + saturnin.py | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/config.py b/config.py index 4f97263..9678491 100644 --- a/config.py +++ b/config.py @@ -99,3 +99,4 @@ times_up_delays = [60*10, 60*20] times_up_sentences = [u"I stayed alive, you're too slow !!!"] ignored_pseudos = r'^Soldat\d+$' +ignored_pan_masks = [r'*!leger@zamok.crans.org', u"jben!*@*"] diff --git a/saturnin.py b/saturnin.py index f2b432c..3b43531 100755 --- a/saturnin.py +++ b/saturnin.py @@ -56,6 +56,11 @@ def is_something(chain,matches,avant=u".*(?:^| )",apres=u"(?:$|\.| |,|;).*",case regexp_pan = re.compile(u".*(" + "|".join(config.killwords) + u").*") def is_pan(chain): return regexp_pan.match(unicode(chain,"utf8").lower()) +def ignore_pan(serv, ev): + """Retourne ``True`` si il faut ignorer ce pan.""" + for (blackmask, exceptmask) in config.ignored_pan_masks: + usermask = ev.source() + return bool(irclib.mask_matches(usermask, blackmask) and not irclib.mask_matches(usermasl, exceptmask)) class UnicodeBotError(Exception): pass @@ -494,6 +499,8 @@ class Saturnin(ircbot.SingleServerIRCBot): self.sendscores(auteur) else: if is_pan(message): + if ignore_pan(serv, ev): + return self.shot(channel, auteur) def on_action(self, serv, ev): -- 2.39.2