Fix trigger time check to ensure user presence in last_trigger_time dictionary

This commit is contained in:
Joakim Hellsén 2025-08-17 05:03:12 +02:00
commit c3ae6c7073

View file

@ -102,7 +102,7 @@ def should_respond_without_trigger(channel_id: str, user: str, threshold_seconds
Returns: Returns:
True if the bot should respond without trigger keywords, False otherwise. True if the bot should respond without trigger keywords, False otherwise.
""" """
if channel_id not in last_trigger_time: if channel_id not in last_trigger_time or user not in last_trigger_time[channel_id]:
return False return False
last_trigger: datetime.datetime = last_trigger_time[channel_id][user] last_trigger: datetime.datetime = last_trigger_time[channel_id][user]