From: Vincent Le Gallic Date: Sat, 25 May 2013 21:03:26 +0000 (+0200) Subject: jben is trying harder X-Git-Url: http://gitweb.pimeys.fr/?a=commitdiff_plain;h=fd087472ed16a00627af6fd60ea1e8d06374bfe1;p=bots%2Fsaturnin.git jben is trying harder --- 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):