return o
def is_insult(chain,debug=True):
- return is_something(chain,config_insultes,avant=".*(^| |')")
+ return is_something(chain,config_insultes,avant=".*(?:^| |')")
def is_not_insult(chain):
chain=unicode(chain,"utf8")
insult_regexp=u"("+u"|".join(config_insultes)+u")"
- middle_regexp=u"(un(|e) ((putain|enfoiré) d(e |'))*|)(| super )( (gros|petit|grand|énorme) |)"
+ middle_regexp=u"(une? (?:(?:putain|enfoiré) d(?:e |'))*|)(?:| super )(?: (?:gros|petit|grand|énorme) |)"
reg=".*pas %s%s.*"%(middle_regexp,insult_regexp)
if re.match(reg,chain):
return True
return is_something(chain,config_tamere_triggers)
def is_bad_action_trigger(chain,pseudo):
return is_something(chain,config_bad_action_triggers,avant=u"^",
- apres="( [a-z]*ment)? %s($|\.| |,|;).*"%(pseudo))
+ apres="(?: [a-z]*ment)? %s($|\.| |,|;).*"%(pseudo))
def is_good_action_trigger(chain,pseudo):
return is_something(chain,config_good_action_triggers,avant=u"^",
- apres="( [a-z]*ment)? %s($|\.| |,|;).*"%(pseudo))
+ apres="(?: [a-z]*ment)? %s($|\.| |,|;).*"%(pseudo))
def is_pan(chain):
return re.match(u"^(pan|bim|bang) .*$",unicode(chain,"utf8").lower().strip())
serv.action(channel,l2[i-n1].encode("utf8"))
else:
serv.privmsg(channel,"%s: %s"%(auteur,l1[i].encode("utf8")))
-
+ if is_good_action_trigger(action,mypseudo) and not channel in self.quiet_channels:
+ l1,l2=config_good_action_answers,config_good_action_actions
+ n1,n2=len(l1),len(l2)
+ i=random.randrange(n1+n2)
+ if i>=n1:
+ serv.action(channel,l2[i-n1].encode("utf8"))
+ else:
+ serv.privmsg(channel,"%s: %s"%(auteur,l1[i].encode("utf8")))
+
def on_kick(self,serv,ev):
auteur = irclib.nm_to_n(ev.source())
channel = ev.target()