Fix KeyError: 'fastest_shot' by ensuring complete channel records initialization

- Fixed incomplete channel_records initialization in shoot command
- Fixed incomplete channel_records initialization in wild shot tracking
- All channel records now properly include: fastest_shot, last_duck, total_ducks, total_shots
- Resolves runtime error when update_channel_records tries to access fastest_shot field
This commit is contained in:
2025-09-13 15:07:32 +01:00
parent 62da9d1c28
commit 2bbc202f8f

View File

@@ -899,7 +899,12 @@ class SimpleIRCBot:
# Track total shots for channel statistics
if channel not in self.channel_records:
self.channel_records[channel] = {'total_shots': 0, 'total_ducks': 0}
self.channel_records[channel] = {
'fastest_shot': None,
'last_duck': None,
'total_ducks': 0,
'total_shots': 0
}
self.channel_records[channel]['total_shots'] += 1
# Check for hit
@@ -1004,7 +1009,12 @@ class SimpleIRCBot:
# Track wild shots in channel statistics
if channel not in self.channel_records:
self.channel_records[channel] = {'total_shots': 0, 'total_ducks': 0}
self.channel_records[channel] = {
'fastest_shot': None,
'last_duck': None,
'total_ducks': 0,
'total_shots': 0
}
self.channel_records[channel]['total_shots'] += 1
# Calculate penalties based on level