This commit closes #4 and closes #6

This commit is contained in:
Profitroll
2023-02-19 20:54:58 +01:00
parent 8bafd0cb35
commit 056fc52353
3 changed files with 17 additions and 7 deletions

View File

@@ -149,25 +149,27 @@ async def get_submission(app: PosterClient, msg: Message):
if msg.from_user.id in app.admins and configGet("admins", "submission", "require_confirmation") is False:
try:
await app.submit_photo(str(inserted.inserted_id))
await msg.copy(app.owner, caption=caption)
await msg.reply_text(locale("sub_yes_auto", "message", locale=user_locale), quote=True)
await msg.copy(app.owner, caption=caption, disable_notification=True)
return
except SubmissionDuplicatesError as exp:
await msg.reply_text(locale("sub_media_duplicates_list", "message", locale=user_locale).format("\n".join(exp.duplicates)), quote=True)
return
except Exception as exp:
await msg.reply_text(format_exc())
await msg.reply_text(format_exc(), quote=True)
return
elif msg.from_user.id not in app.admins and configGet("users", "submission", "require_confirmation") is False:
try:
await app.submit_photo(str(inserted.inserted_id))
await msg.reply_text(locale("sub_yes_auto", "message", locale=user_locale), quote=True)
await msg.copy(app.owner, caption=caption)
return
except SubmissionDuplicatesError as exp:
await msg.reply_text(locale("sub_media_duplicates_list", "message", locale=user_locale).format("\n".join(exp.duplicates)), quote=True)
await msg.reply_text(locale("sub_dup", "message", locale=user_locale), quote=True)
return
except Exception as exp:
await app.send_message(app.owner, f"User {msg.from_user.id} could not submit photo without additional confirmation due to:\n```\n{format_exc()}\n```")
await msg.reply_text("Could not upload this image. Admins are advised.")
await app.send_message(app.owner, locale("sub_error_admin", "message").format(msg.from_user.id, format_exc()))
await msg.reply_text("sub_error", quote=True)
return
if msg.from_user.id not in app.admins: