X-Git-Url: http://gitweb.pimeys.fr/?a=blobdiff_plain;f=basile.py;h=17a861ce41bf4550482e63a16f79b1f14fbd3a44;hb=513883a68747c4ec8260452cf0cc9f455ca43e29;hp=0dd4f7c62383fb8d9454346c61d15296f6fee4fc;hpb=9004270a5c62cb8cf3dd1e1160ac38bd23d61d53;p=bots%2Fbasile.git diff --git a/basile.py b/basile.py index 0dd4f7c..17a861c 100755 --- a/basile.py +++ b/basile.py @@ -180,7 +180,7 @@ def login_NK(username,password,typ="bdd"): sock=connect_NK() try: # Basile a un compte special user - commande='login [%s,%s,"%s"]'%(json.dumps(username),json.dumps(password),typ) + commande='login [%s,%s,"%s",["note"]]'%(json.dumps(username),json.dumps(password),typ) sock.write(commande) out=sock.read() except Exception as exc: @@ -332,9 +332,10 @@ class Basile(ircbot.SingleServerIRCBot): u"ouvert(|e|s|es)":u"ouverte", u"open":u"open", u"plein(|s|es)":u"pleine", - u"bien plein(|e|s|es)":u"bien pleine"} + u"bien plein(|e|s|es)":u"bien pleine", + u"innocent(|e|s|es)":u"innocente"} adj_reg=u"(?P"+u"|".join(adjectifs.keys())+u")" - reg=u".*(^| )"+debuts+u" "+adj_reg+u"($|,|;|\.| ).*" + reg=u".*(^| |')"+debuts+u" "+adj_reg+u"($|,|;|\.| ).*" matched=re.match(reg,message) if matched: # il faut repasser l'adjectif au féminin singulier @@ -378,7 +379,7 @@ class Basile(ircbot.SingleServerIRCBot): """renvoie (False,lemessage) ou (True, le message amputé de "pseudo: ")""" pseudo=serv.get_nickname() size=len(pseudo) - if message[:size]==pseudo and message[size]==":": + if message[:size]==pseudo and len(message)>size and message[size]==":": return (True,message[size+1:].lstrip(" ")) else: return (False,message) @@ -601,9 +602,10 @@ class Basile(ircbot.SingleServerIRCBot): try: test=bot_unicode(message) except UnicodeBotError: - serv.privmsg(canal, - "%s: Euh, tu fais de la merde avec ton encodage là, j'ai failli crasher…"%(auteur)) - return + if not canal in self.quiet_channels: + serv.privmsg(canal, + "%s: Euh, tu fais de la merde avec ton encodage là, j'ai failli crasher…"%(auteur)) + return pour_moi,message=self.pourmoi(serv,message) if pour_moi and message.split()!=[]: cmd=message.split()[0].lower() @@ -631,7 +633,8 @@ class Basile(ircbot.SingleServerIRCBot): elif cmd in ["reconnect"]: if auteur in self.ops: try: - self.nk=self.new_connection_NK(serv,config_note_pseudo,config_note_password)[1] + self.nk=self.new_connection_NK(serv,config_note_pseudo, + config_note_password,"special")[1] except Exception as exc: self.nk=None log(self.serveur,"""Erreur dans on_pubmsg/"cmd in ["reconnect"]\n"""+str(exc)) @@ -675,8 +678,8 @@ class Basile(ircbot.SingleServerIRCBot): else: serv.privmsg(canal,"%s: Je ne connais pas ton pseudo note."%(auteur)) log(self.serveur,canal,auteur,message+"[unknown]") - elif re.match("!?(pain au chocolat|chocolatine)",message.lower()) - and not canal in self.quiet_channels: + elif (re.match("!?(pain au chocolat|chocolatine)",message.lower()) + and not canal in self.quiet_channels): serv.action(canal,"sert un pain au chocolat à %s"%(auteur)) elif re.match("!?manzana",message.lower()) and not canal in self.quiet_channels: if auteur=="[20-100]":