fix: Ignore empty reminders
All checks were successful
Build Docker / Build Docker (push) Successful in 16s

This commit is contained in:
Nathan Woodburn 2023-11-14 13:26:24 +11:00
parent e0fd085aab
commit b6741bbfcf
Signed by: nathanwoodburn
GPG Key ID: 203B000478AD0EF1

View File

@ -26,6 +26,8 @@ def read_reminders():
try:
with open(REMINDERS_FILE_PATH, 'r') as file:
reminders = [line.strip().split(',') for line in file.readlines()]
# Remove empty lines
reminders = [r for r in reminders if len(r) == 3]
return [{'user_id': r[0], 'time': r[2], 'text': r[3]} for r in reminders]
except FileNotFoundError:
return []