diff --git a/photo_bot/__pycache__/handlers.cpython-313.pyc b/photo_bot/__pycache__/handlers.cpython-313.pyc index d283e37..400f965 100644 Binary files a/photo_bot/__pycache__/handlers.cpython-313.pyc and b/photo_bot/__pycache__/handlers.cpython-313.pyc differ diff --git a/photo_bot/handlers.py b/photo_bot/handlers.py index 8e6f403..57f2ea5 100644 --- a/photo_bot/handlers.py +++ b/photo_bot/handlers.py @@ -167,6 +167,22 @@ async def send_dynamic_photo_main_menu(msg: Message, user_id: str): - иначе/ошибка API — штатное меню входа. Статус проверяется и показывается всегда, включая тестовый режим. """ + # Новый вход в модуль (кнопка 4 из главного меню) = свежий сеанс. + # Тайм-аут сессии чистит только user_states, а module-level pending_photos + # и test_submode_users остаются: висящий тест-кадр из прошлой сессии иначе + # улетит на проверку сразу после нажатия «1». Сбрасываем здесь. + if user_id in pending_photos: + _pd = pending_photos[user_id] + for _k in ('path', 'preview_path'): + _p = _pd.get(_k) + if _p and os.path.exists(_p): + try: + os.remove(_p) + except OSError: + pass + del pending_photos[user_id] + test_submode_users.discard(user_id) + # Статус модерации запрашиваем всегда (и в тестовом режиме тоже) status = await check_moderation_status(user_id) if status.get("status") == "ok" and status.get("moderation_status") == "pending":