Improved avatars preview a bit

This commit is contained in:
Profitroll 2022-11-29 10:37:06 +01:00
parent efcb60ed95
commit c8f1ef5741

View File

@ -53,6 +53,8 @@ async def inline_answer(client, inline_query):
if match.user.photo != None: if match.user.photo != None:
try: try:
if not path.exists(f'{configGet("cache", "locations")}{sep}avatars{sep}{match.user.photo.big_file_id}'):
print(f'Downloaded avatar {match.user.photo.big_file_id} of {match.user.id} and uploaded to {configGet("api")}/?avatar_id={match.user.photo.big_file_id}', flush=True)
await app.download_media(match.user.photo.big_file_id, file_name=f'{configGet("cache", "locations")}{sep}avatars{sep}{match.user.photo.big_file_id}') await app.download_media(match.user.photo.big_file_id, file_name=f'{configGet("cache", "locations")}{sep}avatars{sep}{match.user.photo.big_file_id}')
results.append( results.append(
InlineQueryResultArticle( InlineQueryResultArticle(
@ -64,7 +66,6 @@ async def inline_answer(client, inline_query):
thumb_url=f'{configGet("api")}/?avatar_id={match.user.photo.big_file_id}' thumb_url=f'{configGet("api")}/?avatar_id={match.user.photo.big_file_id}'
) )
) )
print(f'{configGet("api")}/?avatar_id={match.user.photo.big_file_id}', flush=True)
except ValueError: except ValueError:
results.append( results.append(
InlineQueryResultArticle( InlineQueryResultArticle(