diff --git a/handlers/keys/keys.py b/handlers/keys/keys.py index 3c2a0672..cf886a22 100644 --- a/handlers/keys/keys.py +++ b/handlers/keys/keys.py @@ -7,7 +7,7 @@ from aiogram import Router, types from auth import login_with_credentials, link_subscription from bot import bot from client import add_client, delete_client, extend_client_key -from config import ADMIN_PASSWORD, ADMIN_USERNAME, DATABASE_URL, SERVERS +from config import ADMIN_PASSWORD, ADMIN_USERNAME, DATABASE_URL, SERVERS, APP_URL from database import get_balance, update_balance from handlers.texts import NO_KEYS from handlers.texts import key_message, key_relocated @@ -345,9 +345,7 @@ async def process_callback_select_server(callback_query: types.CallbackQuery): if not success_delete: raise Exception(f"Ошибка при удалении клиента с сервера {current_server_id}") - response_message = ( - key_relocated(new_key) - ) + response_message = key_relocated(new_key) except Exception as e: response_message = f"Ключ перемещен, но возникла ошибка при удалении клиента с текущего сервера: {e}" @@ -355,7 +353,21 @@ async def process_callback_select_server(callback_query: types.CallbackQuery): response_message = "Ключ не найден или уже удален." back_button = types.InlineKeyboardButton(text='Назад', callback_data='view_keys') - keyboard = types.InlineKeyboardMarkup(inline_keyboard=[[back_button]]) + iphone_button = types.InlineKeyboardButton( + text='🍏IPhone', + url=f'{APP_URL}/?url=streisand://import/{new_key}' + ) + android_button = types.InlineKeyboardButton( + text='🤖Android', + url=f'{APP_URL}/?url=v2rayng://install-sub?url={new_key}' + ) + + keyboard = types.InlineKeyboardMarkup( + inline_keyboard=[ + [back_button], + [iphone_button, android_button] + ] + ) await bot.edit_message_text( response_message, chat_id=tg_id, message_id=callback_query.message.message_id, diff --git a/handlers/start.py b/handlers/start.py index d3d140d8..d44bad0a 100644 --- a/handlers/start.py +++ b/handlers/start.py @@ -6,7 +6,7 @@ from aiogram.types import (BufferedInputFile, CallbackQuery, InlineKeyboardButton, InlineKeyboardMarkup, Message) from handlers.texts import ABOUT_VPN, WELCOME_TEXT from bot import bot -from config import CHANNEL_URL, SUPPORT_CHAT_URL +from config import CHANNEL_URL, SUPPORT_CHAT_URL, APP_URL from database import add_connection, add_referral, check_connection_exists, get_trial from handlers.keys.trial_key import create_trial_key from handlers.texts import INSTRUCTIONS_TRIAL @@ -74,16 +74,29 @@ async def handle_connect_vpn(callback_query: CallbackQuery): f"Ваш ключ доступа:\n
{trial_key_info['key']}\n\n"
f"Инструкции:\n{INSTRUCTIONS_TRIAL}"
)
-
+
button_profile = InlineKeyboardButton(text='👤 Мой профиль', callback_data='view_profile')
- inline_keyboard_profile = InlineKeyboardMarkup(inline_keyboard=[[button_profile]])
+
+ button_iphone = InlineKeyboardButton(
+ text='🍏IPhone',
+ url=f'{APP_URL}/?url=streisand://import/{trial_key_info["key"]}'
+ )
+ button_android = InlineKeyboardButton(
+ text='🤖Android',
+ url=f'{APP_URL}/?url=v2rayng://install-sub?url={trial_key_info["key"]}'
+ )
+
+ inline_keyboard = InlineKeyboardMarkup(inline_keyboard=[
+ [button_iphone, button_android],
+ [button_profile]
+ ])
await callback_query.message.answer(
key_message,
parse_mode='HTML',
- reply_markup=inline_keyboard_profile
+ reply_markup=inline_keyboard
)
-
+
await callback_query.answer()
@router.callback_query(lambda c: c.data == 'about_vpn')