log: Try to find error of not sending reminder
All checks were successful
Build Docker / Build Docker (push) Successful in 17s

This commit is contained in:
Nathan Woodburn 2023-11-14 13:37:07 +11:00
parent 65d7252f5f
commit a05702c2be
Signed by: nathanwoodburn
GPG Key ID: 203B000478AD0EF1

3
bot.py
View File

@ -469,6 +469,7 @@ async def remindme(ctx, when: str, reminder: str):
await ctx.response.send_message("Invalid time format. Please use something like `1d 3h` or `4hr`.",ephemeral=True) await ctx.response.send_message("Invalid time format. Please use something like `1d 3h` or `4hr`.",ephemeral=True)
async def check_reminders(): async def check_reminders():
print("Checking reminders", flush=True)
now = datetime.datetime.now() now = datetime.datetime.now()
reminders = read_reminders() reminders = read_reminders()
@ -477,8 +478,8 @@ async def check_reminders():
if reminder_time <= now: if reminder_time <= now:
user = await client.fetch_user(int(reminder['user_id'])) user = await client.fetch_user(int(reminder['user_id']))
await user.send("G'day,\nI need to remind you of:\n" + reminder['text']) await user.send("G'day,\nI need to remind you of:\n" + reminder['text'])
print("Reminder sent", flush=True)
reminders.remove(reminder) reminders.remove(reminder)
write_reminders(reminders) write_reminders(reminders)