Skip to content

Commit

Permalink
deal with non-int message ids
Browse files Browse the repository at this point in the history
  • Loading branch information
elasticroentgen committed Jan 18, 2024
1 parent 6346198 commit bb477af
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -366,12 +366,17 @@ async def get_last_message_id(channel):
last_msg_id = int(initial_content)
except ClientError:
print("The location is non existent on S3.")
except ValueError:
print("Non-int message id.")

else:
if os.path.exists(loc_path):
with open(loc_path, 'r', encoding='utf-8') as f:
f_content = f.read()
last_msg_id = int(f_content)
try:
if os.path.exists(loc_path):
with open(loc_path, 'r', encoding='utf-8') as f:
f_content = f.read()
last_msg_id = int(f_content)
except ValueError:
print("Non-int message id.")
return last_msg_id


Expand Down

0 comments on commit bb477af

Please sign in to comment.