]> gitweb.pimeys.fr Git - bots/saturnin.git/commitdiff
jben is trying harder
authorVincent Le Gallic <legallic@crans.org>
Sat, 25 May 2013 21:03:26 +0000 (23:03 +0200)
committerVincent Le Gallic <legallic@crans.org>
Sat, 25 May 2013 21:03:26 +0000 (23:03 +0200)
config.py
saturnin.py

index 4f9726378976faa92de5fa2e003fd9bb54de2d76..96784910c5afa61a5541feabcf21e4eb7725864b 100644 (file)
--- 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!*@*"]
index f2b432c5f5a9326a9158148e19e7223ce22e83d2..3b43531fb133e9c3f8d04afd321438432c90e348 100755 (executable)
@@ -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):