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