From d100dc7b2d3bd5d6e97ceeadd532512bcd367aee Mon Sep 17 00:00:00 2001 From: Zakhar Izmaylov Date: Thu, 21 Nov 2024 20:49:58 +0300 Subject: [PATCH] Update instructions --- handlers/instructions/instructions.py | 14 +++++++++----- handlers/profile.py | 18 ++++++++++-------- 2 files changed, 19 insertions(+), 13 deletions(-) diff --git a/handlers/instructions/instructions.py b/handlers/instructions/instructions.py index f5945dba..0af5a49b 100644 --- a/handlers/instructions/instructions.py +++ b/handlers/instructions/instructions.py @@ -2,7 +2,8 @@ import os import asyncpg from aiogram import F, Router, types -from aiogram.types import BufferedInputFile, InlineKeyboardButton, InlineKeyboardMarkup +from aiogram.types import BufferedInputFile, InlineKeyboardButton +from aiogram.utils.keyboard import InlineKeyboardBuilder from bot import bot from config import CONNECT_WINDOWS, DATABASE_URL, SUPPORT_CHAT_URL @@ -24,17 +25,20 @@ async def send_instructions(callback_query: types.CallbackQuery): await callback_query.answer() return - back_button = InlineKeyboardButton( - text="⬅️ Вернуться в профиль", callback_data="view_profile" + builder = InlineKeyboardBuilder() + builder.row(InlineKeyboardButton(text="💬 Поддержка", url=SUPPORT_CHAT_URL)) + builder.row( + InlineKeyboardButton( + text="⬅️ Вернуться в профиль", callback_data="view_profile" + ), ) - keyboard = InlineKeyboardMarkup(inline_keyboard=[[back_button]]) with open(image_path, "rb") as image_from_buffer: await callback_query.message.answer_photo( BufferedInputFile(image_from_buffer.read(), filename="instructions.jpg"), caption=instructions_message, parse_mode="Markdown", - reply_markup=keyboard, + reply_markup=builder.as_markup(), ) await callback_query.answer() diff --git a/handlers/profile.py b/handlers/profile.py index 39cb3652..c152ce58 100644 --- a/handlers/profile.py +++ b/handlers/profile.py @@ -8,7 +8,7 @@ from aiogram.utils.keyboard import InlineKeyboardBuilder from bot import bot from config import CHANNEL_URL from database import get_balance, get_key_count, get_referral_stats -from handlers.texts import get_referral_link, invite_message_send, profile_message_send,RENEWAL_PLANS +from handlers.texts import RENEWAL_PLANS, get_referral_link, invite_message_send, profile_message_send from logger import logger router = Router() @@ -103,13 +103,15 @@ async def view_tariffs_handler(callback_query: types.CallbackQuery): ) await callback_query.message.answer( - "🚀 Доступные тарифы VPN:\n\n" + - "\n".join([ - f"{months} {'месяц' if months == '1' else 'месяца' if int(months) in [2, 3, 4] else 'месяцев'}: " - f"{RENEWAL_PLANS[months]['price']} " - f"{'💳' if months == '1' else '🌟' if months == '3' else '🔥' if months == '6' else '🚀'} рублей" - for months in sorted(RENEWAL_PLANS.keys(), key=int) - ]), + "🚀 Доступные тарифы VPN:\n\n" + + "\n".join( + [ + f"{months} {'месяц' if months == '1' else 'месяца' if int(months) in [2, 3, 4] else 'месяцев'}: " + f"{RENEWAL_PLANS[months]['price']} " + f"{'💳' if months == '1' else '🌟' if months == '3' else '🔥' if months == '6' else '🚀'} рублей" + for months in sorted(RENEWAL_PLANS.keys(), key=int) + ] + ), parse_mode="HTML", reply_markup=builder.as_markup(), )