From 69abc00abcbd35217d25339e554965f90733c0d9 Mon Sep 17 00:00:00 2001 From: gsd Date: Sun, 23 Apr 2023 18:29:37 +0300 Subject: [PATCH] =?UTF-8?q?=D0=B4=D0=B5=D0=BD=D1=8C=D0=B3=D0=B8=20=D0=BC?= =?UTF-8?q?=D0=BD=D0=B5=20=D0=BD=D0=B5=D1=81=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- user_ext/buyvip.py | 26 +++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/user_ext/buyvip.py b/user_ext/buyvip.py index c3d8d39..afbb56b 100644 --- a/user_ext/buyvip.py +++ b/user_ext/buyvip.py @@ -1,4 +1,6 @@ import discord +import aiohttp +import os class Extension: def __init__(self, core): @@ -19,12 +21,22 @@ class Extension: Кнопочки ниже ведут на ссылки которые гарантируют покупку випа на профиль привязанный к дискорду: {player.community_url} """ + prices = [] + async with aiohttp.ClientSession() as session: + async with session.get(f"{os.getenv('BACKEND_URL')}/api/external/vip", ssl=False) as response: + prices = await response.json() + view = discord.ui.View() - view.add_item(discord.ui.Button(label="Qiwi Месяц - 150 Рублей", url=f"https://tf2.pblr-nyk.pro/api/profile/current/buyvip?buy_type=qiwi&steam64={steam64}&cost=150")) - view.add_item(discord.ui.Button(label="Qiwi Неделя - 75 Рублей", url=f"https://tf2.pblr-nyk.pro/api/profile/current/buyvip?buy_type=qiwi&steam64={steam64}&cost=75")) - view.add_item(discord.ui.Button(label="Qiwi День - 20 Рублей", url=f"https://tf2.pblr-nyk.pro/api/profile/current/buyvip?buy_type=qiwi&steam64={steam64}&cost=20")) - ##### - view.add_item(discord.ui.Button(label="Steam Месяц - 1 Ключ маннко", url=f"https://tf2.pblr-nyk.pro/api/profile/current/buyvip?buy_type=steam")) - view.add_item(discord.ui.Button(label="Steam Неделя - 20 Рефов", url=f"https://tf2.pblr-nyk.pro/api/profile/current/buyvip?buy_type=steam")) - view.add_item(discord.ui.Button(label="Steam День - 5 Рефов", url=f"https://tf2.pblr-nyk.pro/api/profile/current/buyvip?buy_type=steam")) + #qiwi + for price in prices: + if price["money_price"] == 0: + continue + view.add_item(discord.ui.Button(label=f"Qiwi {price['human_duration'].split()[1]} - {price['money_price']} Рублей", url=f"https://tf2.pblr-nyk.pro/api/profile/current/buyvip?buy_type=qiwi&steam64={steam64}&cost={price['money_price']}")) + + #steam + for price in prices: + if price["money_price"] == 0: + continue + view.add_item(discord.ui.Button(label=f"Steam {price['human_duration'].split()[1]} - {price['item_price']}", url=f"https://tf2.pblr-nyk.pro/api/profile/current/buyvip?buy_type=steam")) + return await interaction.followup.send(content=content, view=view, ephemeral=False) \ No newline at end of file