]> gitweb.pimeys.fr Git - bots/basile.git/blobdiff - basile.py
cafouillage sur les masque special/bdd au login
[bots/basile.git] / basile.py
index 14769c36df39f086feb371bf84601985faf20fdc..f92fe673855077abf151c54ddf6bc5c1f30c9c54 100755 (executable)
--- a/basile.py
+++ b/basile.py
@@ -178,9 +178,13 @@ def connect_NK():
 
 def login_NK(username,password,typ="bdd"):
     sock=connect_NK()
+    if typ=="special": # ça c'est pour Basile lui-même
+        masque='["note"]'
+    elif typ=="bdd":
+        masque='[["all"],["all"],false]'
     try:
         # Basile a un compte special user
-        commande='login [%s,%s,"%s"]'%(json.dumps(username),json.dumps(password),typ)
+        commande='login [%s,%s,"%s",%s]'%(json.dumps(username),json.dumps(password),typ,masque)
         sock.write(commande)
         out=sock.read()
     except Exception as exc:
@@ -379,7 +383,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 +606,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()