From 040e32a50a7e17ad1c632e949c9d731a2c5e5810 Mon Sep 17 00:00:00 2001 From: Vladless Date: Wed, 30 Oct 2024 20:05:38 +0300 Subject: [PATCH] =?UTF-8?q?=D0=9A=D0=BD=D0=BE=D0=BF=D0=BA=D0=B0=20=D0=B0?= =?UTF-8?q?=D0=B2=D1=82=D0=BE=D0=B4=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB=D0=B5?= =?UTF-8?q?=D0=BD=D0=B8=D1=8F=20=D0=BA=D0=BE=D0=BD=D1=84=D0=B8=D0=B3=D1=83?= =?UTF-8?q?=D1=80=D0=B0=D1=86=D0=B8=D0=B8=20=D0=B2=20=D0=BA=D0=BB=D0=B8?= =?UTF-8?q?=D0=B5=D0=BD=D1=82=D1=81=D0=BA=D0=BE=D0=B5=20=D0=BF=D1=80=D0=B8?= =?UTF-8?q?=D0=BB=D0=BE=D0=B6=D0=B5=D0=BD=D0=B8=D0=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- handlers/keys/keys.py | 22 +++++++++++++++++----- handlers/start.py | 23 ++++++++++++++++++----- 2 files changed, 35 insertions(+), 10 deletions(-) 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')