pc instructions and button

This commit is contained in:
Vladless
2024-11-15 21:49:27 +03:00
parent b96c42c153
commit e2796d22e2
3 changed files with 61 additions and 7 deletions
+2
View File
@@ -14,6 +14,7 @@ from handlers import commands, coupons, donate, notifications, pay, profile, sta
from handlers.admin import admin_commands, admin_coupons, admin_panel, admin_user_editor
from handlers.keys import key_management, keys
from handlers.payments import cryprobot_pay, freekassa_pay, robokassa_pay, stars_pay, yookassa_pay
from handlers.instructions import instructions
dp.include_router(admin_commands.router)
dp.include_router(admin_coupons.router)
@@ -27,6 +28,7 @@ dp.include_router(keys.router)
dp.include_router(key_management.router)
dp.include_router(pay.router)
dp.include_router(notifications.router)
dp.include_router(instructions.router)
dp.include_router(donate.router)
if YOOKASSA_ENABLE:
dp.include_router(yookassa_pay.router)
+51 -1
View File
@@ -4,8 +4,13 @@ from aiogram import types
from aiogram.types import BufferedInputFile, InlineKeyboardButton, InlineKeyboardMarkup
from handlers.texts import INSTRUCTIONS
from bot import bot
from aiogram import F, Router, types
from config import SUPPORT_CHAT_URL, CONNECT_WINDOWS
from loguru import logger
from handlers.texts import KEY_MESSAGE, INSTRUCTION_PC
router = Router()
async def send_instructions(callback_query: types.CallbackQuery):
await callback_query.message.delete()
@@ -32,3 +37,48 @@ async def send_instructions(callback_query: types.CallbackQuery):
)
await callback_query.answer()
@router.callback_query(F.data.startswith("connect_pc|"))
async def process_connect_pc(callback_query: types.CallbackQuery):
tg_id = callback_query.from_user.id
key = callback_query.data.split("|")[1]
try:
await bot.delete_message(
chat_id=tg_id, message_id=callback_query.message.message_id
)
except Exception as e:
logger.error(f"Ошибка при удалении сообщения: {e}")
key_message = KEY_MESSAGE.format(key)
instruction_message = f"{key_message}{INSTRUCTION_PC}"
connect_windows_button = types.InlineKeyboardButton(
text="💻 Подключить Windows", url=f"{CONNECT_WINDOWS}{key}"
)
support_button = types.InlineKeyboardButton(
text="🆘 Поддержка", url=f"{SUPPORT_CHAT_URL}"
)
back_button = types.InlineKeyboardButton(
text="🔙 Назад в профиль", callback_data="view_profile"
)
inline_keyboard = [
[connect_windows_button],
[support_button],
[back_button]
]
keyboard = types.InlineKeyboardMarkup(inline_keyboard=inline_keyboard)
await bot.send_message(
tg_id,
instruction_message,
reply_markup=keyboard,
parse_mode="HTML"
)
await callback_query.answer()
+8 -6
View File
@@ -186,20 +186,21 @@ async def process_callback_view_key(callback_query: types.CallbackQuery):
)
download_android_button = types.InlineKeyboardButton(
text="🤖 Скачать",
url=DOWNLOAD_ANDROID,
text="🤖 Скачать", url=DOWNLOAD_ANDROID
)
download_iphone_button = types.InlineKeyboardButton(
text="🍏 Скачать",
url=DOWNLOAD_IOS,
text="🍏 Скачать", url=DOWNLOAD_IOS
)
connect_iphone_button = types.InlineKeyboardButton(
text="🍏 Подключить", url=f"{CONNECT_IOS}{key}"
)
connect_android_button = types.InlineKeyboardButton(
text="🤖 Подключить",
url=f"{CONNECT_ANDROID}{key}",
text="🤖 Подключить", url=f"{CONNECT_ANDROID}{key}"
)
connect_pc_button = types.InlineKeyboardButton(
text="💻 Windows/Linux", callback_data=f"connect_pc|{key}"
)
renew_button = types.InlineKeyboardButton(
@@ -215,6 +216,7 @@ async def process_callback_view_key(callback_query: types.CallbackQuery):
inline_keyboard = [
[download_iphone_button, download_android_button],
[connect_iphone_button, connect_android_button],
[connect_pc_button], # Добавляем кнопки для Windows и Linux
[renew_button, delete_button],
]