|
|
@ -5,6 +5,7 @@ from steam import SteamID |
|
|
|
|
|
|
|
class BackendClient: |
|
|
|
up = False |
|
|
|
warn = False |
|
|
|
|
|
|
|
def __init__(self): |
|
|
|
if not os.getenv("BACKEND_URL", ""): |
|
|
@ -24,16 +25,20 @@ class BackendClient: |
|
|
|
try: |
|
|
|
await response.text() |
|
|
|
self.up = True |
|
|
|
if not self.warn: |
|
|
|
info("Backend connected!") |
|
|
|
self.warn = True |
|
|
|
except: |
|
|
|
error("Backend not respond") |
|
|
|
traceback.print_exc() |
|
|
|
self.up = False |
|
|
|
self.warn = False |
|
|
|
return self.up |
|
|
|
|
|
|
|
async def vip(self, steamid: SteamID, amount: int, extra: str): |
|
|
|
async with aiohttp.ClientSession(cookies={ |
|
|
|
"secretkey":self.secret_key}) as session: |
|
|
|
async with session.post(self.vip_url + f"?steam={steamid.id64}&amount={amount}&service=steam&extra={extra}", ssl=False) as response: |
|
|
|
async with session.post(self.vip_url + f"?steam={steamid.id64}&amount={int(amount)}&service=steam&extra={extra}", ssl=False) as response: |
|
|
|
try: |
|
|
|
result = int(await response.text()) |
|
|
|
if result == 0: |
|
|
|