Added support for duplicates access tokens

This commit is contained in:
Profitroll 2023-02-18 00:55:58 +01:00
parent 7607003f55
commit b3698cfa70
2 changed files with 3 additions and 3 deletions

View File

@ -63,8 +63,8 @@ async def upload_pic(filepath: str, token: Union[str, None] = None) -> Tuple[boo
raise SubmissionUploadError(str(filepath), response.status_code, response.content)
duplicates = []
if "duplicates" in response.json():
for duplicate in response.json()["duplicates"]:
duplicates.append(f'{configGet("address_external", "posting", "api")}/photos/{duplicate["id"]}')
for index, duplicate in enumerate(response.json()["duplicates"]):
duplicates.append(f'`{duplicate["id"]}`:\n{configGet("address_external", "posting", "api")}/token/photo/{response.json()["access_token"]}?id={index}')
return True, duplicates
except:
return False, []

View File

@ -28,7 +28,7 @@ async def callback_query_yes(app: PosterClient, clb: CallbackQuery):
return
except SubmissionDuplicatesError as exp:
await clb.answer(text=locale("sub_duplicates_found", "callback", locale=user_locale), show_alert=True)
await clb.message.reply_text(locale("sub_media_duplicates_list", "message", locale=user_locale).format("\n".join(exp.duplicates)), quote=True)
await clb.message.reply_text(locale("sub_media_duplicates_list", "message", locale=user_locale).format("\n".join(exp.duplicates)), disable_web_page_preview=True, quote=True)
return
if submission is not None: