Update instructions

This commit is contained in:
Zakhar Izmaylov
2024-11-21 20:49:58 +03:00
parent 384c2c4c1c
commit d100dc7b2d
2 changed files with 19 additions and 13 deletions
+9 -5
View File
@@ -2,7 +2,8 @@ import os
import asyncpg import asyncpg
from aiogram import F, Router, types 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 bot import bot
from config import CONNECT_WINDOWS, DATABASE_URL, SUPPORT_CHAT_URL 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() await callback_query.answer()
return return
back_button = InlineKeyboardButton( builder = InlineKeyboardBuilder()
text="⬅️ Вернуться в профиль", callback_data="view_profile" 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: with open(image_path, "rb") as image_from_buffer:
await callback_query.message.answer_photo( await callback_query.message.answer_photo(
BufferedInputFile(image_from_buffer.read(), filename="instructions.jpg"), BufferedInputFile(image_from_buffer.read(), filename="instructions.jpg"),
caption=instructions_message, caption=instructions_message,
parse_mode="Markdown", parse_mode="Markdown",
reply_markup=keyboard, reply_markup=builder.as_markup(),
) )
await callback_query.answer() await callback_query.answer()
+10 -8
View File
@@ -8,7 +8,7 @@ from aiogram.utils.keyboard import InlineKeyboardBuilder
from bot import bot from bot import bot
from config import CHANNEL_URL from config import CHANNEL_URL
from database import get_balance, get_key_count, get_referral_stats 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 from logger import logger
router = Router() router = Router()
@@ -103,13 +103,15 @@ async def view_tariffs_handler(callback_query: types.CallbackQuery):
) )
await callback_query.message.answer( await callback_query.message.answer(
"<b>🚀 Доступные тарифы VPN:</b>\n\n" + "<b>🚀 Доступные тарифы VPN:</b>\n\n"
"\n".join([ + "\n".join(
f"{months} {'месяц' if months == '1' else 'месяца' if int(months) in [2, 3, 4] else 'месяцев'}: " [
f"{RENEWAL_PLANS[months]['price']} " f"{months} {'месяц' if months == '1' else 'месяца' if int(months) in [2, 3, 4] else 'месяцев'}: "
f"{'💳' if months == '1' else '🌟' if months == '3' else '🔥' if months == '6' else '🚀'} рублей" f"{RENEWAL_PLANS[months]['price']} "
for months in sorted(RENEWAL_PLANS.keys(), key=int) 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", parse_mode="HTML",
reply_markup=builder.as_markup(), reply_markup=builder.as_markup(),
) )