diff --git a/handlers/start.py b/handlers/start.py index 3c15d9bc..9d168326 100644 --- a/handlers/start.py +++ b/handlers/start.py @@ -7,7 +7,7 @@ from aiogram.fsm.context import FSMContext from aiogram.types import BufferedInputFile, CallbackQuery, InlineKeyboardButton, Message from aiogram.utils.keyboard import InlineKeyboardBuilder -from config import CHANNEL_URL, CONNECT_ANDROID, CONNECT_IOS, DOWNLOAD_ANDROID, DOWNLOAD_IOS, SUPPORT_CHAT_URL +from config import CHANNEL_URL, CHANNEL_EXISTS, CONNECT_ANDROID, CONNECT_IOS, DOWNLOAD_ANDROID, DOWNLOAD_IOS, SUPPORT_CHAT_URL from database import add_connection, add_referral, check_connection_exists, get_trial, use_trial from handlers.keys.trial_key import create_trial_key from handlers.texts import INSTRUCTIONS_TRIAL, WELCOME_TEXT, get_about_vpn @@ -40,10 +40,15 @@ async def start_command(message: Message, state: FSMContext, session: Any, admin builder.row(InlineKeyboardButton(text="🔗 Подключить VPN", callback_data="connect_vpn")) builder.row(InlineKeyboardButton(text="👤 Личный кабинет", callback_data="profile")) - builder.row( - InlineKeyboardButton(text="📞 Поддержка", url=SUPPORT_CHAT_URL), - InlineKeyboardButton(text="📢 Канал", url=CHANNEL_URL), - ) + if CHANNEL_EXISTS: + builder.row( + InlineKeyboardButton(text="📞 Поддержка", url=SUPPORT_CHAT_URL), + InlineKeyboardButton(text="📢 Канал", url=CHANNEL_URL), + ) + else: + builder.row( + InlineKeyboardButton(text="📞 Поддержка", url=SUPPORT_CHAT_URL) + ) if admin: builder.row(InlineKeyboardButton(text="🔧 Администратор", callback_data="admin")) @@ -111,9 +116,10 @@ async def handle_about_vpn(callback_query: CallbackQuery): builder.row( InlineKeyboardButton(text="📞 Техническая поддержка", url=SUPPORT_CHAT_URL), ) - builder.row( - InlineKeyboardButton(text="📢 Официальный канал", url=CHANNEL_URL), - ) + if CHANNEL_EXISTS: + builder.row( + InlineKeyboardButton(text="📢 Официальный канал", url=CHANNEL_URL), + ) builder.row(InlineKeyboardButton(text="⬅️ Назад", callback_data="start")) await callback_query.message.answer(get_about_vpn("3.2.2-Release"), reply_markup=builder.as_markup())