]> gitweb.pimeys.fr Git - bots/deconnaisseur.git/commitdiff
implémentation utf8_trigger + utf8_trigger = False
authorVincent Le Gallic <legallic@crans.org>
Mon, 30 Jul 2012 17:06:14 +0000 (19:06 +0200)
committerVincent Le Gallic <legallic@crans.org>
Mon, 30 Jul 2012 17:06:14 +0000 (19:06 +0200)
config.py
deconnaisseur.py

index 762532eb2633302a72674b5f8d91c3349cddd951..00b0f64aa319102c35e9b17d60781a8eed8d42d9 100644 (file)
--- a/config.py
+++ b/config.py
@@ -11,6 +11,10 @@ ops=["Nit","Eguel","Harry"]
 
 report_bugs_to =["[20-100]"]
 
 
 report_bugs_to =["[20-100]"]
 
+# config UTF8-fail
+utf8_fail_answers = [u"Euh, tu fais de la merde avec ton encodage là, j'ai failli crasher…"]
+utf8_trigger = False # râlé-je en cas de non-utf8 ?
+
 source_file="deconnaissances.txt"
 played_file_template="played.%s.txt" #il faut rajouter le nom du serveur
 
 source_file="deconnaissances.txt"
 played_file_template="played.%s.txt" #il faut rajouter le nom du serveur
 
index 3cc3f4774d215a7c9ee6b06bdfd89e14469fd16a..8007c9e9d363ae7095ebf764998801a773e58260 100755 (executable)
@@ -199,8 +199,8 @@ class Deconnaisseur(ircbot.SingleServerIRCBot):
         try:
             test=bot_unicode(message)
         except UnicodeBotError:
         try:
             test=bot_unicode(message)
         except UnicodeBotError:
-            serv.privmsg(auteur,
-              "Euh, tu fais de la merde avec ton encodage là, j'ai failli crasher…")
+            if config.utf8_trigger:
+                serv.privmsg(auteur, config.utf8_fail_answers)
             return
         message=message.split()
         cmd=message[0].lower()
             return
         message=message.split()
         cmd=message[0].lower()
@@ -448,9 +448,8 @@ class Deconnaisseur(ircbot.SingleServerIRCBot):
         try:
             test=bot_unicode(message)
         except UnicodeBotError:
         try:
             test=bot_unicode(message)
         except UnicodeBotError:
-            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))
+            if not canal in self.quiet_channels and config.utf8_trigger:
+                serv.privmsg(canal, "%s: %s"%(auteur,config.utf8_fail_answers))
             return
         tryother=False
         pour_moi,message=self.pourmoi(serv,message)
             return
         tryother=False
         pour_moi,message=self.pourmoi(serv,message)