X-Git-Url: http://gitweb.pimeys.fr/?p=bots%2Fsaturnin.git;a=blobdiff_plain;f=saturnin.py;fp=saturnin.py;h=3b43531fb133e9c3f8d04afd321438432c90e348;hp=f2b432c5f5a9326a9158148e19e7223ce22e83d2;hb=fd087472ed16a00627af6fd60ea1e8d06374bfe1;hpb=b71142838d23a2e278774665a825e80a11a9bb6f 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):