Skip to content

Commit

Permalink
make it more robust
Browse files Browse the repository at this point in the history
  • Loading branch information
elasticroentgen committed Feb 6, 2024
1 parent 76137b9 commit 65678ad
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -315,6 +315,14 @@ async def backup_channel(channel, last_message_id):
# exit the function with no new location msg id
return None

except:
if after is not None:
print('Cant pull more messages - stopping here for now.')
pass
else:
print('Failed channel pull - skipping')
return None

# Seal the manifest
seal_manifest(channel.guild.id, channel.id)

Expand Down Expand Up @@ -555,7 +563,7 @@ async def on_ready():
if not isinstance(channel, nextcord.TextChannel):
continue

print(f'Backing up Channel {channel.id} on {channel.guild.id}')
print(f'Backing up Channel {channel.name} on {channel.guild.name}')

# Backup channels
last_msg_id = await get_last_message_id(channel)
Expand All @@ -565,7 +573,7 @@ async def on_ready():

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

last_msg_id = await get_last_message_id(thread)
new_last_msg_id = await backup_channel(thread, last_msg_id)
Expand Down

0 comments on commit 65678ad

Please sign in to comment.