X-Git-Url: http://gitweb.pimeys.fr/?a=blobdiff_plain;f=basile.py;h=17a861ce41bf4550482e63a16f79b1f14fbd3a44;hb=513883a68747c4ec8260452cf0cc9f455ca43e29;hp=51304ed80cc21d1353b4f86a91dea40c1ef3c627;hpb=252d8ac3295648c47acef85083fd424461d834ee;p=bots%2Fbasile.git diff --git a/basile.py b/basile.py index 51304ed..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: @@ -335,7 +335,7 @@ class Basile(ircbot.SingleServerIRCBot): 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 @@ -379,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) @@ -602,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()