Skip to content

Commit 141bcc8

Browse files
don't set last msg on empty channel
1 parent a077339 commit 141bcc8

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

‎main.py‎

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -324,7 +324,7 @@ async def backup_channel(channel, last_message_id):
324324
print(f'No manifest for {channel.guild.id} - {channel.id}. Likly empty channel. Skipping S3 upload.')
325325

326326
if after is None:
327-
return -1
327+
return None
328328
return after.id
329329

330330

@@ -550,15 +550,17 @@ async def on_ready():
550550
# Backup channels
551551
last_msg_id = await get_last_message_id(channel)
552552
new_last_msg_id = await backup_channel(channel, last_msg_id)
553-
await set_last_message_id(channel, new_last_msg_id)
553+
if last_msg_id is not None:
554+
await set_last_message_id(channel, new_last_msg_id)
554555

555556
# Backup threads in channel
556557
for thread in channel.threads:
557558
print(f'Backing up Thread {thread.id} in Channel {channel.id} on {channel.guild.id}')
558559

559560
last_msg_id = await get_last_message_id(thread)
560561
new_last_msg_id = await backup_channel(thread, last_msg_id)
561-
await set_last_message_id(thread, new_last_msg_id)
562+
if new_last_msg_id is not None:
563+
await set_last_message_id(thread, new_last_msg_id)
562564

563565
# Quit when done
564566
print('Notifying the heartbeat check...')

0 commit comments

Comments
 (0)