Skip to content

Commit

Permalink
fix silly bug on response time purging
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisrude committed May 10, 2023
1 parent e64acfd commit 6deb9f3
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/oobabot/discord_bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -515,9 +515,11 @@ def should_send_unsolicited_response(self, message: discord.Message) -> bool:

def purge_outdated_response_times(self) -> None:
oldest_time_to_keep = time.time() - self.PURGE_LAST_RESPONSE_TIME_AFTER
for channel_id, last_response_time in self.channel_last_direct_response.items():
if last_response_time < oldest_time_to_keep:
del self.channel_last_direct_response[channel_id]
self.channel_last_direct_response = {
channel_id: last_response_time
for channel_id, last_response_time in self.channel_last_direct_response.items()
if last_response_time >= oldest_time_to_keep
}

def should_reply_to_message(self, message: discord.Message) -> bool:
# ignore messages from other bots, out of fear of infinite loops,
Expand Down

0 comments on commit 6deb9f3

Please sign in to comment.