Added support for duplicates access tokens
This commit is contained in:
parent
7607003f55
commit
b3698cfa70
@ -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)
|
raise SubmissionUploadError(str(filepath), response.status_code, response.content)
|
||||||
duplicates = []
|
duplicates = []
|
||||||
if "duplicates" in response.json():
|
if "duplicates" in response.json():
|
||||||
for duplicate in response.json()["duplicates"]:
|
for index, duplicate in enumerate(response.json()["duplicates"]):
|
||||||
duplicates.append(f'{configGet("address_external", "posting", "api")}/photos/{duplicate["id"]}')
|
duplicates.append(f'`{duplicate["id"]}`:\n{configGet("address_external", "posting", "api")}/token/photo/{response.json()["access_token"]}?id={index}')
|
||||||
return True, duplicates
|
return True, duplicates
|
||||||
except:
|
except:
|
||||||
return False, []
|
return False, []
|
||||||
|
@ -28,7 +28,7 @@ async def callback_query_yes(app: PosterClient, clb: CallbackQuery):
|
|||||||
return
|
return
|
||||||
except SubmissionDuplicatesError as exp:
|
except SubmissionDuplicatesError as exp:
|
||||||
await clb.answer(text=locale("sub_duplicates_found", "callback", locale=user_locale), show_alert=True)
|
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
|
return
|
||||||
|
|
||||||
if submission is not None:
|
if submission is not None:
|
||||||
|
Reference in New Issue
Block a user