From 141bcc88883cff831ef35e87db0f3daf3328724f Mon Sep 17 00:00:00 2001 From: Markus Keil Date: Wed, 17 Jan 2024 18:49:18 +0100 Subject: [PATCH] don't set last msg on empty channel --- main.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/main.py b/main.py index e8b5fe5..1fc4271 100644 --- a/main.py +++ b/main.py @@ -324,7 +324,7 @@ async def backup_channel(channel, last_message_id): print(f'No manifest for {channel.guild.id} - {channel.id}. Likly empty channel. Skipping S3 upload.') if after is None: - return -1 + return None return after.id @@ -550,7 +550,8 @@ async def on_ready(): # Backup channels last_msg_id = await get_last_message_id(channel) new_last_msg_id = await backup_channel(channel, last_msg_id) - await set_last_message_id(channel, new_last_msg_id) + if last_msg_id is not None: + await set_last_message_id(channel, new_last_msg_id) # Backup threads in channel for thread in channel.threads: @@ -558,7 +559,8 @@ async def on_ready(): last_msg_id = await get_last_message_id(thread) new_last_msg_id = await backup_channel(thread, last_msg_id) - await set_last_message_id(thread, new_last_msg_id) + if new_last_msg_id is not None: + await set_last_message_id(thread, new_last_msg_id) # Quit when done print('Notifying the heartbeat check...')