Фикс keyboards: убрал дубли, добавил account/popup/payment_methods
This commit is contained in:
@@ -1,18 +1,10 @@
|
||||
from aiogram.types import InlineKeyboardButton
|
||||
from aiogram.utils.keyboard import InlineKeyboardBuilder
|
||||
from aiogram.utils.keyboard import InlineKeyboardBuilder, ReplyKeyboardBuilder
|
||||
from aiogram.types import InlineKeyboardButton, KeyboardButton
|
||||
|
||||
|
||||
from aiogram.utils.keyboard import InlineKeyboardBuilder, ReplyKeyboardBuilder
|
||||
from aiogram.types import InlineKeyboardButton, KeyboardButton
|
||||
|
||||
# ... остальной код выше не трогаем ...
|
||||
|
||||
|
||||
def main_keyboard():
|
||||
"""
|
||||
Главное меню (только визуал перетянут под твой стиль)
|
||||
Главное меню
|
||||
"""
|
||||
builder = InlineKeyboardBuilder()
|
||||
builder.row(
|
||||
@@ -33,7 +25,6 @@ def main_keyboard():
|
||||
callback_data="faq",
|
||||
)
|
||||
)
|
||||
# Оставляем URL как у Вовы, меняем только текст
|
||||
builder.row(
|
||||
InlineKeyboardButton(
|
||||
text="ℹ️ О нас",
|
||||
@@ -43,7 +34,31 @@ def main_keyboard():
|
||||
return builder.as_markup()
|
||||
|
||||
|
||||
def account_keyboard():
|
||||
"""
|
||||
Клавиатура профиля:
|
||||
только пополнить баланс и история транзакций.
|
||||
"""
|
||||
builder = InlineKeyboardBuilder()
|
||||
builder.row(
|
||||
InlineKeyboardButton(
|
||||
text="🪙 Пополнить баланс",
|
||||
callback_data="balance",
|
||||
)
|
||||
)
|
||||
builder.row(
|
||||
InlineKeyboardButton(
|
||||
text="🧾 История транзакций",
|
||||
callback_data="tranhist",
|
||||
)
|
||||
)
|
||||
return builder.as_markup()
|
||||
|
||||
|
||||
def balance_keyboard():
|
||||
"""
|
||||
Экран баланса
|
||||
"""
|
||||
builder = InlineKeyboardBuilder()
|
||||
builder.row(
|
||||
InlineKeyboardButton(
|
||||
@@ -66,6 +81,64 @@ def balance_keyboard():
|
||||
return builder.as_markup()
|
||||
|
||||
|
||||
def popup_keyboard():
|
||||
"""
|
||||
Суммы пополнения.
|
||||
"""
|
||||
builder = InlineKeyboardBuilder()
|
||||
builder.row(
|
||||
InlineKeyboardButton(text="200 ₽", callback_data="popup:200"),
|
||||
InlineKeyboardButton(text="500 ₽", callback_data="popup:500"),
|
||||
)
|
||||
builder.row(
|
||||
InlineKeyboardButton(text="1000 ₽", callback_data="popup:1000"),
|
||||
InlineKeyboardButton(text="2000 ₽", callback_data="popup:2000"),
|
||||
)
|
||||
builder.row(
|
||||
InlineKeyboardButton(text="3000 ₽", callback_data="popup:3000"),
|
||||
InlineKeyboardButton(text="5000 ₽", callback_data="popup:5000"),
|
||||
)
|
||||
builder.row(
|
||||
InlineKeyboardButton(
|
||||
text="🔙 Назад",
|
||||
callback_data="balance",
|
||||
)
|
||||
)
|
||||
return builder.as_markup()
|
||||
|
||||
|
||||
def payment_methods_keyboard(amount: int):
|
||||
"""
|
||||
Способы оплаты для выбранной суммы.
|
||||
"""
|
||||
builder = InlineKeyboardBuilder()
|
||||
builder.row(
|
||||
InlineKeyboardButton(
|
||||
text="⭐ Telegram Stars",
|
||||
callback_data=f"method_stars_{amount}",
|
||||
)
|
||||
)
|
||||
builder.row(
|
||||
InlineKeyboardButton(
|
||||
text="💵 YooKassa",
|
||||
callback_data=f"method_ykassa_{amount}",
|
||||
)
|
||||
)
|
||||
builder.row(
|
||||
InlineKeyboardButton(
|
||||
text="🪙 CryptoBot",
|
||||
callback_data=f"method_crypto_{amount}",
|
||||
)
|
||||
)
|
||||
builder.row(
|
||||
InlineKeyboardButton(
|
||||
text="🔙 Назад",
|
||||
callback_data="popup",
|
||||
)
|
||||
)
|
||||
return builder.as_markup()
|
||||
|
||||
|
||||
def ticket_list_keyboard(tickets):
|
||||
builder = InlineKeyboardBuilder()
|
||||
for ticket in tickets:
|
||||
@@ -145,164 +218,8 @@ def buy_keyboard():
|
||||
|
||||
|
||||
def tarif_Lark_keyboard():
|
||||
builder = InlineKeyboardBuilder()
|
||||
builder.row(
|
||||
InlineKeyboardButton(
|
||||
text="🐣 Lark 1 месяц",
|
||||
callback_data="Lark:Standart:1",
|
||||
)
|
||||
)
|
||||
builder.row(
|
||||
InlineKeyboardButton(
|
||||
text="🐣 Lark 6 месяцев",
|
||||
callback_data="Lark:Standart:6",
|
||||
)
|
||||
)
|
||||
builder.row(
|
||||
InlineKeyboardButton(
|
||||
text="🐣 Lark 12 месяцев",
|
||||
callback_data="Lark:Standart:12",
|
||||
)
|
||||
)
|
||||
builder.row(
|
||||
InlineKeyboardButton(
|
||||
text="🔙 Назад",
|
||||
callback_data="buy_subscription",
|
||||
)
|
||||
)
|
||||
return builder.as_markup()
|
||||
|
||||
|
||||
def tarif_Lark_pro_keyboard():
|
||||
builder = InlineKeyboardBuilder()
|
||||
builder.row(
|
||||
InlineKeyboardButton(
|
||||
text="🦅 Lark Pro 1 месяц",
|
||||
callback_data="Lark:Pro:1",
|
||||
)
|
||||
)
|
||||
builder.row(
|
||||
InlineKeyboardButton(
|
||||
text="🦅 Lark Pro 6 месяцев",
|
||||
callback_data="Lark:Pro:6",
|
||||
)
|
||||
)
|
||||
builder.row(
|
||||
InlineKeyboardButton(
|
||||
text="🦅 Lark Pro 12 месяцев",
|
||||
callback_data="Lark:Pro:12",
|
||||
)
|
||||
)
|
||||
builder.row(
|
||||
InlineKeyboardButton(
|
||||
text="🔙 Назад",
|
||||
callback_data="buy_subscription",
|
||||
)
|
||||
)
|
||||
return builder.as_markup()
|
||||
|
||||
|
||||
def tarif_Lark_family_keyboard():
|
||||
builder = InlineKeyboardBuilder()
|
||||
builder.row(
|
||||
InlineKeyboardButton(
|
||||
text="👨👩👧 Lark Family 1 месяц",
|
||||
callback_data="Lark:Family:1",
|
||||
)
|
||||
)
|
||||
builder.row(
|
||||
InlineKeyboardButton(
|
||||
text="👨👩👧 Lark Family 6 месяцев",
|
||||
callback_data="Lark:Family:6",
|
||||
)
|
||||
)
|
||||
builder.row(
|
||||
InlineKeyboardButton(
|
||||
text="👨👩👧 Lark Family 12 месяцев",
|
||||
callback_data="Lark:Family:12",
|
||||
)
|
||||
)
|
||||
builder.row(
|
||||
InlineKeyboardButton(
|
||||
text="🔙 Назад",
|
||||
callback_data="buy_subscription",
|
||||
)
|
||||
)
|
||||
return builder.as_markup()
|
||||
|
||||
|
||||
def subscriptions_card_keyboard(sub_id: str, index: int, total: int):
|
||||
"""
|
||||
Карточка подписки:
|
||||
- навигация ⬅️/➡️
|
||||
- 'Конфиг' / 'Продлить'
|
||||
- 'Новая' / 'Назад'
|
||||
"""
|
||||
builder = InlineKeyboardBuilder()
|
||||
|
||||
nav = []
|
||||
if index > 0:
|
||||
nav.append(
|
||||
InlineKeyboardButton(
|
||||
text="⬅️",
|
||||
callback_data=f"sub_prev:{index-1}",
|
||||
)
|
||||
)
|
||||
if index < total - 1:
|
||||
nav.append(
|
||||
InlineKeyboardButton(
|
||||
text="➡️",
|
||||
callback_data=f"sub_next:{index+1}",
|
||||
)
|
||||
)
|
||||
if nav:
|
||||
builder.row(*nav)
|
||||
|
||||
builder.row(
|
||||
InlineKeyboardButton(
|
||||
text="🔑 Конфиг",
|
||||
callback_data=f"sub_cfg:{sub_id}",
|
||||
),
|
||||
InlineKeyboardButton(
|
||||
text="🔁 Продлить",
|
||||
callback_data=f"sub_renew:{sub_id}",
|
||||
),
|
||||
)
|
||||
builder.row(
|
||||
InlineKeyboardButton(
|
||||
text="➕ Новая",
|
||||
callback_data="buy_subscription",
|
||||
)
|
||||
)
|
||||
builder.row(
|
||||
InlineKeyboardButton(
|
||||
text="🔙 Назад",
|
||||
callback_data="profile",
|
||||
)
|
||||
)
|
||||
return builder.as_markup()
|
||||
|
||||
|
||||
def tarif_confirm_keyboard(name: str, amount: int, classif: str):
|
||||
builder = InlineKeyboardBuilder()
|
||||
builder.row(
|
||||
InlineKeyboardButton(
|
||||
text="✅ Подтвердить",
|
||||
callback_data=f"confirm:{name}_{classif}_{amount}",
|
||||
)
|
||||
)
|
||||
builder.row(
|
||||
InlineKeyboardButton(
|
||||
text="🔙 Отменить",
|
||||
callback_data="buy_subscription",
|
||||
)
|
||||
)
|
||||
return builder.as_markup()
|
||||
|
||||
|
||||
def tarif_Lark_keyboard():
|
||||
"""
|
||||
Тариф Lark (Standart) — только подписи меняем.
|
||||
Тариф Lark Basic (Standart)
|
||||
"""
|
||||
builder = InlineKeyboardBuilder()
|
||||
builder.row(
|
||||
@@ -396,6 +313,56 @@ def tarif_Lark_family_keyboard():
|
||||
return builder.as_markup()
|
||||
|
||||
|
||||
def subscriptions_card_keyboard(sub_id: str, index: int, total: int):
|
||||
"""
|
||||
Карточка подписки:
|
||||
навигация, конфиг, продление, новая, назад.
|
||||
"""
|
||||
builder = InlineKeyboardBuilder()
|
||||
|
||||
nav = []
|
||||
if index > 0:
|
||||
nav.append(
|
||||
InlineKeyboardButton(
|
||||
text="⬅️",
|
||||
callback_data=f"sub_prev:{index-1}",
|
||||
)
|
||||
)
|
||||
if index < total - 1:
|
||||
nav.append(
|
||||
InlineKeyboardButton(
|
||||
text="➡️",
|
||||
callback_data=f"sub_next:{index+1}",
|
||||
)
|
||||
)
|
||||
if nav:
|
||||
builder.row(*nav)
|
||||
|
||||
builder.row(
|
||||
InlineKeyboardButton(
|
||||
text="🔑 Конфиг",
|
||||
callback_data=f"sub_cfg:{sub_id}",
|
||||
),
|
||||
InlineKeyboardButton(
|
||||
text="🔁 Продлить",
|
||||
callback_data=f"sub_renew:{sub_id}",
|
||||
),
|
||||
)
|
||||
builder.row(
|
||||
InlineKeyboardButton(
|
||||
text="➕ Новая",
|
||||
callback_data="buy_subscription",
|
||||
)
|
||||
)
|
||||
builder.row(
|
||||
InlineKeyboardButton(
|
||||
text="🔙 Назад",
|
||||
callback_data="profile",
|
||||
)
|
||||
)
|
||||
return builder.as_markup()
|
||||
|
||||
|
||||
def guide_keyboard():
|
||||
"""
|
||||
Руководство по подключению
|
||||
@@ -450,7 +417,7 @@ def tranhist_keyboard():
|
||||
return builder.as_markup()
|
||||
|
||||
|
||||
def tarif_confirm_keyboard(name, amount, classif):
|
||||
def tarif_confirm_keyboard(name: str, amount: int, classif: str):
|
||||
"""
|
||||
Подтверждение покупки тарифа
|
||||
"""
|
||||
@@ -472,8 +439,7 @@ def tarif_confirm_keyboard(name, amount, classif):
|
||||
|
||||
def confirm_popup_keyboard():
|
||||
"""
|
||||
аааааааааааааааааааааа
|
||||
|
||||
Подтверждение пополнения.
|
||||
"""
|
||||
builder = InlineKeyboardBuilder()
|
||||
builder.row(
|
||||
|
||||
Reference in New Issue
Block a user