From 6c00f08603260e9f3aa65c776355e1f1790521fc Mon Sep 17 00:00:00 2001 From: Klafyvel Date: Tue, 28 Aug 2018 21:55:39 +0200 Subject: [PATCH] ajustement des timers --- bots.yaml | 2 +- klafirc/bot.py | 4 ++-- klafirc/loader.py | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/bots.yaml b/bots.yaml index a9f3fe4..406a1a6 100644 --- a/bots.yaml +++ b/bots.yaml @@ -32,7 +32,6 @@ bots: 'matrix.*irc' : "> {message}\nLes vrais font tourner matrix dans un tmux." 'proxmox' : "promox c'est surfait, faut l'autoremove" on_join: 'Unleash the salt' - min_time: 120 Macron: on_ping: - "PARCE QUE C'EST NOTRE PROJEEEET !" @@ -41,6 +40,7 @@ bots: 'tocard' : "Est-ce que je peux dire autocar ?" 'Manu.*\?' : "Tu m’appelles monsieur le président de la République, ou monsieur." 'aides sociales' : "Ça coûte un pognon dingue !" + min_time: 30 # in seconds Patou: on_ping: - "En parlant de ça, Centrale ne sait vraiment pas travailler en multicampus" diff --git a/klafirc/bot.py b/klafirc/bot.py index 85cdb71..832b9f2 100644 --- a/klafirc/bot.py +++ b/klafirc/bot.py @@ -19,7 +19,7 @@ class Bot: self.on_join = None self.tg_user_match = re.compile('^<\x03..\x02\x02(?P.+)\x03>') self.ping_match = re.compile('^(<.+> )?\@?{name}'.format(name=nickname)) - self.min_time = 30 + self.min_time = 0 self.last_time = datetime.datetime(1,1,1) def add_reaction(self, match, reaction): @@ -73,7 +73,7 @@ class Bot: """ if (datetime.datetime.now() - self.last_time).total_seconds() < self.min_time: return [] - username = username.split('!')[0] + username = user.split('!')[0] tg_user_match = self.tg_user_match.match(message) if 'bot' in username.lower() and tg_user_match: username = '@' + tg_user_match.groupdict()['username'] diff --git a/klafirc/loader.py b/klafirc/loader.py index 7007c62..d55ac18 100644 --- a/klafirc/loader.py +++ b/klafirc/loader.py @@ -29,7 +29,7 @@ class Loader: b.add_python_reaction(match, matches[match]) b.on_join = template.get('on_join', None) - b.min_time = template.get('min_time', 30) + b.min_time = template.get('min_time', 20) return b