Фото: pending — только статус (без «пришлите фото», без номера); тест-приветствие без блока модерации
This commit is contained in:
Binary file not shown.
+5
-15
@@ -29,7 +29,6 @@ from utils.texts import (
|
||||
photo_error_already_pending,
|
||||
photo_cancel_text,
|
||||
photo_preview_ready,
|
||||
photo_moderation_pending,
|
||||
photo_welcome_with_status,
|
||||
photo_invalid_cmd,
|
||||
photo_test_welcome,
|
||||
@@ -175,20 +174,13 @@ async def send_dynamic_photo_main_menu(msg: Message, user_id: str):
|
||||
if status.get("status") == "ok" and status.get("moderation_status") == "pending":
|
||||
# Фото на модерации — штатная загрузка заблокирована,
|
||||
# но модуль остаётся открыт (PHOTO_MODE), чтобы цифры не ушли в главное меню
|
||||
photo_id = status.get("photo_id", "???")
|
||||
log_menu_stats(user_id, "Photo Bot", "Вход заблокирован — фото на модерации")
|
||||
log_menu_stats(user_id, "Photo Bot", "Вход — фото на модерации")
|
||||
states.set_state(user_id, "PHOTO_MODE")
|
||||
moderation_pending_users.add(user_id)
|
||||
if config.PHOTO_TEST_MODE:
|
||||
# Единый вход: меню + «фото на модерации» + кнопка «1 — тест проверка фото».
|
||||
# Единый вход: «фото на модерации» (+ кнопка 1 — тест, если тест-режим включён).
|
||||
# Описание тест-режима показываем ТОЛЬКО после нажатия кнопки 1
|
||||
await msg.answer(
|
||||
photo_welcome_with_status(status, show_test=True),
|
||||
parse_mode="html"
|
||||
)
|
||||
else:
|
||||
await msg.answer(
|
||||
photo_moderation_pending(photo_id),
|
||||
photo_welcome_with_status(status, show_test=config.PHOTO_TEST_MODE),
|
||||
parse_mode="html"
|
||||
)
|
||||
return
|
||||
@@ -258,12 +250,11 @@ async def photo_module_handler(msg: Message):
|
||||
and status.get("moderation_status") == "pending"
|
||||
)
|
||||
if still_pending:
|
||||
photo_id = status.get("photo_id", "???")
|
||||
if config.PHOTO_TEST_MODE and (cmd == "1" or in_test_submode(user_id)):
|
||||
# Вход в тест-под-режим (кнопка 1) / повтор его сообщения
|
||||
test_submode_users.add(user_id)
|
||||
log_menu_stats(user_id, "Photo Bot (TEST)", "Тест-под-режим (фото на модерации)")
|
||||
await msg.answer(photo_test_welcome(photo_id), parse_mode="html")
|
||||
await msg.answer(photo_test_welcome(), parse_mode="html")
|
||||
else:
|
||||
# стандартная ошибка: кнопок, кроме 0 (и 1 в тест-режиме), нет
|
||||
await msg.answer(photo_invalid_cmd(), parse_mode="html")
|
||||
@@ -286,9 +277,8 @@ async def photo_module_handler(msg: Message):
|
||||
if user_id not in pending_photos and not is_attachment:
|
||||
status = await check_moderation_status(user_id)
|
||||
if status.get("status") == "ok" and status.get("moderation_status") == "pending":
|
||||
photo_id = status.get("photo_id", "???")
|
||||
await msg.answer(
|
||||
photo_moderation_pending(photo_id),
|
||||
photo_welcome_with_status(status, show_test=config.PHOTO_TEST_MODE),
|
||||
parse_mode="html"
|
||||
)
|
||||
return
|
||||
|
||||
Binary file not shown.
+20
-21
@@ -202,11 +202,18 @@ def sd_file_upload_error() -> str:
|
||||
|
||||
# --- Private functions (Internal logic) ---
|
||||
|
||||
def _photo_welcome(emojis: dict, show_test: bool = False, info: str = None) -> str:
|
||||
def _photo_welcome(emojis: dict, show_test: bool = False, info: str = None, pending: bool = False) -> str:
|
||||
"""Входное сообщение фото-режима. info — необязательный блок о статусе
|
||||
модерации (отказ/ожидание) — вставляется перед списком кнопок."""
|
||||
text = (
|
||||
f"🖼 <b>Режим обновления фото профиля</b>\n\n"
|
||||
модерации (отказ). pending=True — фото уже на модерации: без призыва
|
||||
отправить фото, только статус."""
|
||||
text = f"🖼 <b>Режим обновления фото профиля</b>\n\n"
|
||||
if pending:
|
||||
text += (
|
||||
f"⏳ <b>У вас уже есть фото на модерации.</b>\n"
|
||||
f"Ожидайте решения модератора.\n\n"
|
||||
)
|
||||
else:
|
||||
text += (
|
||||
f"📸 Пришлите мне вашу фотографию.\n\n"
|
||||
f"Бот автоматически найдёт лицо, покажет превью\n"
|
||||
f"и отправит фото на публикацию в ваши корпоративные сервисы.\n\n"
|
||||
@@ -249,13 +256,6 @@ def _photo_ai_processing(emojis: dict) -> str:
|
||||
"Пожалуйста, не закрывайте чат и подождите...</i>"
|
||||
)
|
||||
|
||||
def _photo_moderation_pending(photo_id: str, emojis: dict) -> str:
|
||||
return (
|
||||
f"⏳ <b>У вас уже есть фото на модерации.</b>\n\n"
|
||||
f"Ожидайте решения модератора.\n\n"
|
||||
f"{emojis['0']} — В главное меню"
|
||||
)
|
||||
|
||||
def _photo_status_info(status: dict = None, emojis: dict = None) -> str | None:
|
||||
"""Блок о статусе модерации для входного сообщения. Универсальный для всех
|
||||
случаев: rejected → причина отказа, pending → ожидание, прочее → пусто."""
|
||||
@@ -270,10 +270,8 @@ def _photo_status_info(status: dict = None, emojis: dict = None) -> str | None:
|
||||
f"Пожалуйста, отправьте новое фото."
|
||||
)
|
||||
if ms == "pending":
|
||||
photo_id = status.get("photo_id")
|
||||
num = f" (№ {photo_id})" if photo_id not in (None, "", "???") else ""
|
||||
return (
|
||||
f"⏳ <b>У вас уже есть фото на модерации{num}.</b>\n"
|
||||
f"⏳ <b>У вас уже есть фото на модерации.</b>\n"
|
||||
f"Ожидайте решения модератора."
|
||||
)
|
||||
return None
|
||||
@@ -284,7 +282,7 @@ def _photo_test_welcome(emojis: dict, photo_id: str = None) -> str:
|
||||
text = (
|
||||
f"🧪 <b>Тестовый режим фото-проверки</b>\n\n"
|
||||
f"📸 Пришлите фотографию — она уйдёт <b>напрямую в ИИ</b>.\n"
|
||||
f"Бот покажет вердикт ИИ. <b>Фото никуда не публикуется</b>.\n"
|
||||
f"Бот покажет вердикт ИИ. <b>Фото никуда не публикуется</b>."
|
||||
)
|
||||
if photo_id:
|
||||
text += (
|
||||
@@ -444,15 +442,16 @@ def photo_error_already_pending() -> str:
|
||||
def photo_cancel_text() -> str:
|
||||
return _photo_cancel(EMOJI_DIGITS)
|
||||
|
||||
def photo_moderation_pending(photo_id: str) -> str:
|
||||
return _photo_moderation_pending(photo_id, EMOJI_DIGITS)
|
||||
|
||||
def photo_welcome_with_status(status: dict = None, show_test: bool = False) -> str:
|
||||
"""Универсальное входное сообщение фото-режима: меню + статус модерации,
|
||||
если он требует внимания (отказ с причиной).
|
||||
"""Универсальное входное сообщение фото-режима: меню + статус модерации.
|
||||
pending — только статус (без призыва отправить фото);
|
||||
show_test — добавить кнопку тест-проверки (PHOTO_TEST_MODE)."""
|
||||
info = _photo_status_info(status, EMOJI_DIGITS)
|
||||
return _photo_welcome(EMOJI_DIGITS, show_test=show_test, info=info)
|
||||
pending = bool(
|
||||
status and status.get("status") == "ok"
|
||||
and status.get("moderation_status") == "pending"
|
||||
)
|
||||
return _photo_welcome(EMOJI_DIGITS, show_test=show_test, info=info, pending=pending)
|
||||
|
||||
PHOTO_TEST_WELCOME_TEXT = _photo_test_welcome(EMOJI_DIGITS)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user