Skip to content

Commit

Permalink
Variable renaming
Browse files Browse the repository at this point in the history
  • Loading branch information
kwaaak authored Mar 26, 2019
1 parent f74f8cf commit ef2dcf5
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions sopel/bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -309,19 +309,19 @@ def say(self, text, recipient, max_messages=1):
if not reciprec:
reciprec = self.stack[recipient_id] = {
'messages': [],
'burst': self.config.core.bucket_burst_tokens,
'burst': self.config.core.flood_burst_lines,
}

if not reciprec['burst']:
elapsed = time.time() - reciprec['messages'][-1][0]
reciprec['burst'] = min(
self.config.core.bucket_burst_tokens,
int(elapsed) * self.config.core.bucket_refill_rate)
self.config.core.flood_burst_lines,
int(elapsed) * self.config.core.flood_refill_rate)

if not reciprec['burst']:
elapsed = time.time() - reciprec['messages'][-1][0]
penalty = float(max(0, len(text) - 50)) / 70
wait = self.config.core.bucket_empty_wait + penalty
wait = self.config.core.flood_empty_wait + penalty
if elapsed < wait:
time.sleep(wait - elapsed)

Expand Down

0 comments on commit ef2dcf5

Please sign in to comment.