From 0d88ac6c4f9ed95c41f973d39290c90853be012d Mon Sep 17 00:00:00 2001 From: Vincent Le Gallic Date: Tue, 28 Oct 2014 00:20:13 +0100 Subject: [PATCH] =?utf8?q?On=20ajoute=20la=20possibilit=C3=A9=20de=20ne=20?= =?utf8?q?pas=20parler=20automatiquement?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- config.py | 1 + historien.py | 12 ++++++++---- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/config.py b/config.py index 0c18642..7cfef98 100644 --- a/config.py +++ b/config.py @@ -17,6 +17,7 @@ utf8_trigger = False source_file="dates.txt" played_file_template="played.%s.txt" #il faut rajouter le nom du serveur +auto_trigger=False #est-ce qu'on pose des questions automatiquement ? ttrig=120 #time trigger (normalement 120, mais diminué pour les tests) Ttrig=600 #between two enigms time_incompressible=15 #on peut pas retrigger en dessous de ce temps (60) diff --git a/historien.py b/historien.py index e37cbb5..66a4ff6 100755 --- a/historien.py +++ b/historien.py @@ -146,12 +146,14 @@ class Historien(ircbot.SingleServerIRCBot): for c in self.play_channels: token=time.time()-3600 self.play_status[c]=[0,token] - serv.execute_delayed(random.randrange(config.ttrig),self.start_enigme,(serv,c,token)) + if config.auto_trigger: + serv.execute_delayed(random.randrange(config.ttrig),self.start_enigme,(serv,c,token)) def start_enigme(self,serv,channel,token=None): # On reste silencieux si lechan n'est pas actif if not self.is_active(channel): - serv.execute_delayed(config.ttrig*5,self.start_enigme,(serv,channel,token)) + if config.auto_trigger: + serv.execute_delayed(config.ttrig*5,self.start_enigme,(serv,channel,token)) return if self.play_status[channel][0]==0 and channel in self.play_channels: ok="skip" @@ -190,7 +192,8 @@ class Historien(ircbot.SingleServerIRCBot): serv.privmsg(channel,"C'était le %s"%(date).encode("utf8")) token=time.time() self.play_status[channel]=[0,token] - serv.execute_delayed(random.randrange(config.Ttrig*5,config.Ttrig*10),self.start_enigme,(serv,channel,token)) + if config.auto_trigger: + serv.execute_delayed(random.randrange(config.Ttrig*5,config.Ttrig*10),self.start_enigme,(serv,channel,token)) def get_enigme(self): # on récupère les dates @@ -597,7 +600,8 @@ class Historien(ircbot.SingleServerIRCBot): self.add_score(auteur,score_obtenu) token=time.time() self.play_status[canal]=[0,token] - serv.execute_delayed(random.randrange(config.Ttrig*5,config.Ttrig*10),self.start_enigme,(serv,canal,token)) + if config.auto_trigger: + serv.execute_delayed(random.randrange(config.Ttrig*5,config.Ttrig*10),self.start_enigme,(serv,canal,token)) def on_kick(self,serv,ev): auteur = irclib.nm_to_n(ev.source()) -- 2.39.2