diff --git a/handlers/pay.py b/handlers/pay.py index debe9a3f..6a9c66e9 100644 --- a/handlers/pay.py +++ b/handlers/pay.py @@ -1,14 +1,10 @@ from aiogram import F, Router from aiogram.types import CallbackQuery, InlineKeyboardButton from aiogram.utils.keyboard import InlineKeyboardBuilder -from config import ( - CRYPTO_BOT_ENABLE, - FREEKASSA_ENABLE, - ROBOKASSA_ENABLE, - STARS_ENABLE, - YOOKASSA_ENABLE, - YOOMONEY_ENABLE -) + + +from config import CRYPTO_BOT_ENABLE, FREEKASSA_ENABLE, ROBOKASSA_ENABLE, STARS_ENABLE, YOOKASSA_ENABLE, DONATIONS_ENABLE, YOOMONEY_ENABLE + router = Router() @@ -59,14 +55,11 @@ async def handle_pay(callback_query: CallbackQuery): callback_data="pay_robokassa", ) ) - builder.row( - InlineKeyboardButton( - text="🎟️ Активировать купон", callback_data="activate_coupon" - ) - ) - builder.row( - InlineKeyboardButton(text="💰 Поддержать проект", callback_data="donate") - ) + + builder.row(InlineKeyboardButton(text="🎟️ Активировать купон", callback_data="activate_coupon")) + if DONATIONS_ENABLE: + builder.row(InlineKeyboardButton(text="💰 Поддержать проект", callback_data="donate")) + builder.row(InlineKeyboardButton(text="👤 Личный кабинет", callback_data="profile")) await callback_query.message.answer( diff --git a/handlers/start.py b/handlers/start.py index 04d0847d..b13d27c9 100644 --- a/handlers/start.py +++ b/handlers/start.py @@ -11,22 +11,10 @@ from aiogram.types import ( Message, ) from aiogram.utils.keyboard import InlineKeyboardBuilder -from config import ( - CHANNEL_URL, - 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 config import CHANNEL_URL, CHANNEL_EXISTS, CONNECT_ANDROID, CONNECT_IOS, DOWNLOAD_ANDROID, DOWNLOAD_IOS, SUPPORT_CHAT_URL,DONATIONS_ENABLE +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 @@ -62,10 +50,15 @@ async def start_command(message: Message, state: FSMContext, session: Any, admin ) 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( @@ -139,15 +132,17 @@ async def handle_connect_vpn(callback_query: CallbackQuery, session: Any): @router.callback_query(F.data == "about_vpn") async def handle_about_vpn(callback_query: CallbackQuery): builder = InlineKeyboardBuilder() - builder.row( - InlineKeyboardButton(text="💰 Поддержать проект", callback_data="donate") - ) + + if DONATIONS_ENABLE: + builder.row(InlineKeyboardButton(text="💰 Поддержать проект", callback_data="donate")) + 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(