minor fixes

This commit is contained in:
Vladless
2025-02-02 19:00:22 +03:00
parent 94f3c00628
commit 698b8a9484
3 changed files with 15 additions and 8 deletions
+3 -3
View File
@@ -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(),
)
+12 -5
View File
@@ -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"))
BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 36 KiB