diff --git a/handlers/profile.py b/handlers/profile.py index 37512a67..2deb3153 100644 --- a/handlers/profile.py +++ b/handlers/profile.py @@ -42,7 +42,7 @@ async def process_callback_view_profile( username = callback_query_or_message.from_user.full_name is_callback = False - image_path = os.path.join("img", "pic.jpg") + image_path = os.path.join("img", "profile.jpg") key_count = await get_key_count(chat_id) balance = await get_balance(chat_id) if balance is None: @@ -89,13 +89,13 @@ async def process_callback_view_profile( image_data = await image_file.read() if is_callback: await callback_query_or_message.message.answer_photo( - photo=BufferedInputFile(image_data, filename="pic.jpg"), + photo=BufferedInputFile(image_data, filename="profile.jpg"), caption=profile_message, reply_markup=builder.as_markup(), ) else: await callback_query_or_message.answer_photo( - photo=BufferedInputFile(image_data, filename="pic.jpg"), + photo=BufferedInputFile(image_data, filename="profile.jpg"), caption=profile_message, reply_markup=builder.as_markup(), ) diff --git a/handlers/start.py b/handlers/start.py index e6627c29..4cfb23cf 100644 --- a/handlers/start.py +++ b/handlers/start.py @@ -52,7 +52,10 @@ async def start_command(message: Message, state: FSMContext, session: Any, admin """Обрабатывает команду /start, включая логику проверки подписки, рефералов и подарков.""" logger.info(f"Вызвана функция start_command для пользователя {message.chat.id}") - await state.clear() + try: + await state.clear() + except Exception as e: + logger.warning(f"Не удалось очистить состояние для пользователя {message.chat.id}: {e}") if CAPTCHA_ENABLE and captcha: captcha_data = await generate_captcha(message, state) @@ -254,13 +257,17 @@ async def check_subscription_callback(callback_query: CallbackQuery, state: FSMC async def show_start_menu(message: Message, admin: bool, session: Any): """Функция для отображения стандартного меню""" logger.info(f"Показываю главное меню для пользователя {message.chat.id}") - trial_status = await get_trial(message.chat.id, session) - image_path = os.path.join("img", "pic.jpg") + image_path = os.path.join("img", "pic.jpg") builder = InlineKeyboardBuilder() - if trial_status == 0: - builder.row(InlineKeyboardButton(text="🔗 Подключить VPN", callback_data="create_key")) + if session is not None: + trial_status = await get_trial(message.chat.id, session) + logger.info(f"Trial status для {message.chat.id}: {trial_status}") + if trial_status == 0: + builder.row(InlineKeyboardButton(text="🔗 Подключить VPN", callback_data="create_key")) + else: + logger.warning(f"Сессия базы данных отсутствует, пропускаем проверку триала для {message.chat.id}") builder.row(InlineKeyboardButton(text="👤 Личный кабинет", callback_data="profile")) diff --git a/img/profile.jpg b/img/profile.jpg new file mode 100644 index 00000000..1064f788 Binary files /dev/null and b/img/profile.jpg differ