Skip to content

Commit

Permalink
Partially fixed multiple photos bug - they not overwrite each other a…
Browse files Browse the repository at this point in the history
…nymore. Also removed usage of non-existing message.md_note
  • Loading branch information
dimonier committed Jan 18, 2023
1 parent d090ca8 commit d839ebc
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions tg2obsidian_bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -376,7 +376,7 @@ def embed_formatting(message) -> str:
return note

if len(message['entities']) == 0:
return message.md_text #escape markdown formatting if any
return note

formatted_note = ''
try:
Expand Down Expand Up @@ -433,7 +433,11 @@ def unique_indexed_filename(file: str, path: str) -> str:
while os.path.exists(f'{filexx}{i:02}{filext}'):
# update the incrementing variable
i += 1
return f'{filename}{i:02}{filext}'
unique_indexed_filename = f'{filename}{i:02}{filext}'
# create file to avoid reusing the same file name more than once
with open(os.path.join(path, unique_indexed_filename), 'w') as f:
f.write('')
return unique_indexed_filename


async def get_contact_data(message: Message) -> str:
Expand Down

0 comments on commit d839ebc

Please sign in to comment.