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

@ -15,7 +15,9 @@
"shutdown": "Shutting down bot with pid `{0}`",
"startup": "Starting with pid `{0}`",
"sub_yes": "✅ Submission approved and accepted",
"sub_yes_auto": "✅ Submission automatically accepted",
"sub_no": "❌ Submission reviewed and declined",
"sub_dup": "⚠️ Submission automatically declined because database already contains this photo",
"sub_blocked": "You were blocked and you can't submit media anymore.",
"sub_unblocked": "You were unblocked and you can now submit media.",
"sub_by": "\n\nSubmitted by:",
@ -33,7 +35,9 @@
"post_low": "Low amount of content: `There are only {0} files left in the queue.`",
"api_creds_invalid": "__TO_BE_ADDED__",
"sub_wip": "Post submission is now WIP. It will be available again in a few days. Thank you for your patience.",
"sub_duplicates_found": "__TO_BE_ADDED__"
"sub_duplicates_found": "__TO_BE_ADDED__",
"sub_error": "⚠️ Could not upload this image due to bot error. Admins are advised.",
"sub_error_admin": "User {0} could not submit photo without additional confirmation due to:\n```\n{1}\n```"
},
"button": {
"sub_yes": "✅ Accept",

View File

@ -15,7 +15,9 @@
"shutdown": "Вимкнення бота з підом `{0}`",
"startup": "Запуск бота з підом `{0}`",
"sub_yes": "✅ Подання схвалено та прийнято",
"sub_yes_auto": "✅ Подання автоматично прийнято",
"sub_no": "❌ Подання розглянуто та відхилено",
"sub_dup": "⚠️ Подання автоматично відхилено через наявність цього фото в базі даних",
"sub_blocked": "Вас заблокували, ви більше не можете надсилати медіафайли.",
"sub_unblocked": "Вас розблокували, тепер ви можете надсилати медіафайли.",
"sub_by": "\n\nПредставлено:",
@ -33,7 +35,9 @@
"post_low": "Мала кількість контенту: `Залишилось всього {0} файлів в черзі.`",
"api_creds_invalid": "__TO_BE_ADDED__",
"sub_wip": "Подання постів зараз знаходиться у розробці. Він буде знову доступний через кілька днів. Дякуємо за ваше терпіння.",
"sub_duplicates_found": "__TO_BE_ADDED__"
"sub_duplicates_found": "__TO_BE_ADDED__",
"sub_error": "⚠️ Не вдалось завантажити фото через помилку бота. Адміністрацію повідомлено.",
"sub_error_admin": "Користувач {0} не зміг надіслати фото без додаткової перевірки через помилку:\n```\n{1}\n```"
},
"button": {
"sub_yes": "✅ Прийняти",

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: