From 0f642e3fb6ebe6e1f3b8eaf76f3e19ce73b5f6dc Mon Sep 17 00:00:00 2001 From: kwaaak Date: Tue, 26 Mar 2019 22:19:21 +0100 Subject: [PATCH] Missed some variables --- sopel/bot.py | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/sopel/bot.py b/sopel/bot.py index 81b8d14008..86bae49a14 100644 --- a/sopel/bot.py +++ b/sopel/bot.py @@ -310,21 +310,21 @@ def say(self, text, recipient, max_messages=1): 'flood_left': self.config.core.flood_burst_lines, }) - if not reciprec['flood_left']: - elapsed = time.time() - reciprec['messages'][-1][0] - reciprec['flood_left'] = min( + if not recipient['flood_left']: + elapsed = time.time() - recipient['messages'][-1][0] + recipient['flood_left'] = min( self.config.core.flood_burst_lines, int(elapsed) * self.config.core.flood_refill_rate) - if not reciprec['flood_left']: - elapsed = time.time() - reciprec['messages'][-1][0] + if not recipient['flood_left']: + elapsed = time.time() - recipient['messages'][-1][0] penalty = float(max(0, len(text) - 50)) / 70 wait = self.config.core.flood_empty_wait + penalty if elapsed < wait: time.sleep(wait - elapsed) # Loop detection - messages = [m[1] for m in reciprec['messages'][-8:]] + messages = [m[1] for m in recipient['messages'][-8:]] # If what we about to send repeated at least 5 times in the # last 2 minutes, replace with '...' @@ -335,9 +335,9 @@ def say(self, text, recipient, max_messages=1): return self.write(('PRIVMSG', recipient), text) - reciprec['flood_left'] = max(0, reciprec['flood_left'] - 1) - reciprec['messages'].append((time.time(), self.safe(text))) - reciprec['messages'] = reciprec['messages'][-10:] + recipient['flood_left'] = max(0, recipient['flood_left'] - 1) + recipient['messages'].append((time.time(), self.safe(text))) + recipient['messages'] = recipient['messages'][-10:] finally: self.sending.release() # Now that we've sent the first part, we need to send the rest. Doing