def rand(): ran = random.randint(3, 12) x = "1234567890" y = "1234567890" uname = "" for i in range(ran): first = random.choice( ("Aine", "Aliz", "Amy", "Anya", "Arya", "Ayn", "Bay", "Cia", "laire", "Clor", "Cora", "Coco", "Dawn", "Fleur", "Eva", "Etta", "Erin", "Robin", "Dan", "Camil", "Ringo", "Cayli", "Digna", "Emma", "Galen", "Helma", "Jance", "Gretl", "Hazel", "Gwen", "Helen", "Ella", "Edie", 'Ivy')) second = random.choice( ("Jill", "Joss", "Juno", "Kady", "Kai", "Kira", "Klara", "Lana", "Leda", "Liesl", "Lily", "Amaa", "Mae", "Lula", "Lucia", "Mia", "Myra", "Opal", "Paige", "Rain", "Quinn", "Rose", "Sia", "Taya", "Teva", "markus", "Judie", "Zuri", "Zoe", "Vera", "Una", "Reeve", 'Ekta')) c = random.choice(("1", "2", "3")) if c == "1": uname = first + second elif c == "2": uname = first.title() + second.title() elif c == "3": uname = first + second.title() d = random.choice(x) e = random.choice(y) name = uname + d + e api = HQApi() check = api.check_username(name) if not check: return name else: return rand()
def rand(): ran = random.randint(2, 4) x = "1234567890" name = "Lasie" for i in range(ran): c = random.choice(x) name = name + c api = HQApi() check = api.check_username(name) if not check: return name else: return rand()
def __init__(self, api: HQApi, demo: bool = False, custom_ws: str = None, show_debug: bool = True): # TODO: Rewrite this again self.api = api self.handlers = {} self.token = self.api.token self.headers = self.api.headers self.use_demo = False self.custom_ws = custom_ws try: self.headers["Authorization"] except: if demo: self.use_demo = True else: if not self.custom_ws: raise WebSocketNotAvailable( "You can't use websocket without token") try: self.show = HQApi.get_show(api) self.socket = self.show["broadcast"]["socketUrl"].replace( "https", "wss") self.broadcast = self.show['broadcast']['broadcastId'] except BannedIPError or ApiResponseError: if demo: self.use_demo = True else: if not self.custom_ws: raise WebSocketNotAvailable( "You can't use websocket with banned IP or invalid auth" ) except: if demo: self.use_demo = True else: if not self.custom_ws: raise NotLive("Show isn't live and demo mode is disabled") if self.use_demo: if show_debug: print( "[HQApi] Using demo websocket! Don't create issues with this websocket" ) self.socket = "wss://hqecho.herokuapp.com" # Websocket with questions 24/7 self.broadcast = 1 self.ws = WebSocket(self.socket) elif self.custom_ws: if show_debug: print( "[HQApi] Using custom websocket! Don't create issues with this websocket" ) self.socket = self.custom_ws self.broadcast = 1 self.ws = WebSocket(self.socket) else: self.ws = WebSocket(self.socket) for header, value in self.headers.items(): self.ws.add_header(str.encode(header), str.encode(value))
async def addstock(ctx, number:str): commander_id = ctx.message.author.id if commander_id in red: check_if_exist = numbers_base.find_one({"number": number}) if check_if_exist == None: api = HQApi() verification = api.send_code("+" + number, "sms") async with ctx.typing(): await ctx.send("<@{}> **Please type the OTP within 1 minute. Please don't type wrong**".format(commander_id)) def check(m): return m.author == ctx.message.author and m.channel == ctx.message.channel response = await bot.wait_for('message',check= check, timeout=60) code = int(response.clean_content) sub_code_res = api.confirm_code(verification["verificationId"], code) if sub_code_res['auth'] is not None: print("Sorry, this number is already associated with {}".format(sub_code_res['auth']['username'])) await ctx.send("Sorry, this number is already associated with {}".format(sub_code_res['auth']['username'])) else: a = await ctx.send('**__Login Done! Adding Username__** :wink:') name = rand() print(name) channel = ctx.channel message = a while True: await asyncio.sleep(1) try: token = api.register(verification["verificationId"], name) break except Exception as f: async with ctx.typing(): await message.edit(content="<@{}> **Following error occurred: ```{}```**".format(commander_id,f)) a_token = token["accessToken"] print(a_token) numbers_dict = {'number': number, 'token': a_token} numbers_base.insert_one(numbers_dict) await ctx.send("<@{}> **Successfully created an account **__``{}``__** and been thrown in the stock**".format(commander_id,name)) else: async with ctx.typing(): await ctx.send('<@{}> **Sorry, this number already exist in the database**'.format(commander_id)) else: async with ctx.typing(): await ctx.send('<@{}> This command is not for you'.format(commander_id))
def __init__(self, api: HQApi): self.api = api self.authtoken = HQApi.api(api).authtoken self.region = HQApi.api(api).region self.headers = { "x-hq-stk": base64.b64encode(str(self.region).encode()).decode(), "x-hq-client": "Android/1.20.1", "Authorization": "Bearer " + self.authtoken} if HQApi.get_show(api)["active"]: self.socket = HQApi.get_show(api)["broadcast"]["socketUrl"].replace("https", "wss") self.broadcast = HQApi.get_show(api)['broadcast']['broadcastId'] else: print("Using demo websocket!") self.socket = "ws://hqecho.herokuapp.com" # Websocket with questions 24/7 self.broadcast = 1 self.ws = WebSocket(self.socket) for header, value in self.headers.items(): self.ws.add_header(str.encode(header), str.encode(value)) for _ in self.ws.connect(): self.success = 1
async def join_stock(ctx): berear_list = [] all_data = list(numbers_base.find()) pend = await ctx.send("Trying to Join Game!") joined = 0 for i in all_data: berear_list.append(i['token']) try: for token in berear_list: api = HQApi(token) joined += 1 await pend.edit(content=f"Joined {joined} Account") ws = HQWebSocket(api, demo=False) ws.listen() @ws.event("interaction") def interaction(data): time.sleep(1) exit() except: await ctx.send("Game isn\'t live or id banned")
async def hqplay(ctx, refercode=None): if BOT_OWNER_ROLE in [role.name for role in ctx.message.author.roles]: global count global idk user = ctx.message.author.id print(refercode) embed = discord.Embed(title=f"HQ DAILY CHALLENGE", description="", color=0x73ee57) embed.add_field(name="loading... It may take some second", value='🤔🤔', inline=False) embed.set_footer(text="Hq Daily challenge") x = await ctx.send(embed=embed) token_id = [] ref_list = [] data = list(number_base.find()) p = number_base.find() for i in data: token_id.append(i['userid']) ref_list.append(i['username']) print(ref_list) print(token_id) if user in token_id and refercode in ref_list: use = user p_list = number_base.find_one({ 'userid': use, 'username': refercode })['token'] if p_list == 'NoneType': abed = discord.Embed(title=f"Hq Daily challenge", description="", color=0x73ee57) abed.add_field(name=f"sorry ", value='its not your account', inline=False) await ctx.send(embed=abed) else: pass print(p_list) api = HQApi(p_list) try: offair_id = api.start_offair()['gameUuid'] print(offair_id) except ApiResponseError: url = 'https://api-quiz.hype.space/shows/schedule?&type=' headers = { 'authority': 'api-quiz.hype.space', 'accept': '*/*', 'accept-encoding': 'br, gzip, deflate', 'accept-language': 'en-us', 'authorization': f'Bearer {p_list}', 'user-agent': 'HQ-iOS/159 CFNetwork/975.0.3 Darwin/18.2.0', 'x-hq-client': 'iOS/1.5.2 b159', 'x-hq-country': 'en', 'x-hq-device': 'iPhone11,6', 'x-hq-deviceclass': 'phone', 'x-hq-lang': 'en', 'x-hq-stk': 'MQ==', 'x-hq-timezone': 'America/New_York' } gcheck = requests.get(url, headers=headers).json() embed = discord.Embed(title="Hq Daily challenge", description="", color=0x73ee57) wait1 = gcheck['offairTrivia']['waitTimeMs'] embed.add_field(name="Hq Daily challenge", value=f'❌ Game already played', inline=False) embed.add_field( name="you can't play more game daily challenge right now!!", value=f'use `+hqplay` after **{wait1}** milliseconds ', inline=False) embed.set_footer( text="", icon_url= "https://cdn.discordapp.com/attachments/718400433844125767/740953567996805171/e2faa71710f3f99d507f2b42e2a87563.jpg" ) await client.edit_message(x, embed=embed) offair_id = api.get_schedule( )['offairTrivia']['games'][0]['gameUuid'] print(offair_id) embed = discord.Embed(title=f"HQ DAILY CHALLENGE", description="", color=0x73ee57) embed.add_field(name="Starting playing", value='waiting..', inline=False) embed.set_footer(text="Hq Daily challenge") v = await client.edit_message(x, embed=embed) await asyncio.sleep(3) while True: offair = api.offair_trivia(offair_id) print("Question {0}/{1}".format( offair['question']['questionNumber'], offair['questionCount'])) print(offair['question']['question']) for answer in offair['question']['answers']: print('{0}. {1}'.format(answer['offairAnswerId'], answer['text'])) answers = [ unidecode(answer["text"]) for answer in offair['question']["answers"] ] lol = random.randint(0, 3) q = offair['question']['question'] #print(base) url = 'https://www.dl.dropboxusercontent.com/s/0ea433zcpljtv3j/sitejson.json?dl=0' r = requests.get(url) a = json.loads(r.text) base = {'ques': [], 'right': []} for i in a["questionData"]: c = i['question'] ok = i['answerCounts'] base['ques'].append(c) base['right'].append(ok) basa = base['right'] if q in base['ques']: on = base['ques'].index(q) print(on) print('yes found in database') x = base = {'ques': q} print(x) ans = basa[on] x = 0 for i in ans: print(i) if i['correct'] == True: try: answerdict = answers cor = i['answer'] x = answerdict.index(cor) print(x) except ValueError: lol = random.randint(0, 3) answer = api.send_offair_answer( offair_id, offair['question']['answers'][ lol - 1]['offairAnswerId']) answer = api.send_offair_answer( offair_id, offair['question']['answers'][x] ['offairAnswerId']) ree = answer['seasonXp']['currentPoints'] pe = answer['pointsEarned'] qm = answer['questionNumber'] print(ree) print('You got it right: ' + str(answer['youGotItRight'])) if answer['youGotItRight'] == True: count += 1 else: print('nope not in database') lol = random.randint(0, 3) answer = api.send_offair_answer( offair_id, offair['question']['answers'][lol - 1]['offairAnswerId']) el = HQApi(token=p_list) a = el.get_users_me() for i in a['seasonXp']: idk = i['currentPoints'] pe = answer['pointsEarned'] qm = answer['questionNumber'] print('You got it right: ' + str(answer['youGotItRight'])) if answer['youGotItRight'] == True: count += 1 abed = discord.Embed(title=f"Hq Daily challenge", description=f"{c}", color=0x73ee57) abed.add_field( name=f"<:hhhh:634462529921482762> Username:- {refercode}", value= f'<:hhhh:634462529921482762> Point earned{pe}\n<:hhhh:634462529921482762> Total Points:-{idk}', inline=False) abed.add_field( name=f"Question Correct {count}/{offair['questionCount']}", value='\u200b', inline=False) abed.set_footer(text="Hq Daily challenges playing now") e = await client.edit_message(v, embed=abed) if answer['gameSummary']: print(answer['gameSummary']) print('Game ended') print('Earned:') api = HQApi(token=p_list) a = api.get_users_me() coin = a['coins'] print('Coins: ' + str(answer['gameSummary']['coinsEarned'])) print('Points: ' + str(answer['gameSummary']['pointsEarned'])) embed = discord.Embed(title=f"Hq Daily challenge", description="", color=0x73ee57) embed.add_field( name=f"✅HQ DAILY CHALLENGE PLAYED {refercode}", value= f"<:disco:634462418344345600> Discord user:-<@{user}>", inline=False) embed.add_field( name= f"<:hhhh:634462529921482762> Username:-{refercode}", value= f"**<:hhhh:634462529921482762> Question Correct:-{count}/{offair['questionCount']}\n<:ccccc:634464030446190602> Earned Coins:-{str(answer['gameSummary']['coinsEarned'])}\n<:hhhh:634462529921482762> Earned Points:-{str(answer['gameSummary']['pointsEarned'])}**", inline=False) embed.add_field( name=f"<:hhhh:634462529921482762> Total Points:-{ree}", value= f"**<:hqcoin:637185641565782026> Total Coins:-{coin}**", inline=False) embed.set_footer(text="") await client.edit_message(e, embed=embed) count = 0 break else: await ctx.send('you didn\'t added any number') else: await ctx.send('You have no permission')
from HQApi import HQApi api = HQApi(authtoken="eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VySWQiOjI0ODg1Mjg3LCJ1c2VybmFtZSI6IkFzaGxlbG95ZCIsImF2YXRhclVybCI6Imh0dHBzOi8vY2RuLmh5LnBlL2RhL2dyZWVuLnBuZyIsInRva2VuIjoiUlhOTUlKIiwicm9sZXMiOltdLCJjbGllbnQiOiJpT1MvMS4zLjI0IGIxMTgiLCJndWVzdElkIjpudWxsLCJ2IjoxLCJpYXQiOjE1NDk1NzA4ODYsImV4cCI6MTU1NzM0Njg4NiwiaXNzIjoiaHlwZXF1aXovMSJ9.JFYR1fyHGNNy3Ycc0tcOHxeW3bBP9MBOV9W_afVyEew") print(api.get_users_me())
def fetch(args): api = HQApi(logintoken=args.logintoken, token=args.token) print(api.fetch(method=args.method, func=args.function, data=args.data))
from lomond.persist import persist from HQApi import HQApi, HQWebSocket token = "Token" api = HQApi(token) ws = HQWebSocket(api, demo=True) websocket = ws.get() for msg in persist(websocket): if msg.name == "text": print(msg.text)
async def hq(ctx, message=None): api = HQApi() phonenumber = message print(phonenumber) x = api.send_code("+" + phonenumber, "sms") print(x) v = x['verificationId'] global smscode smscode = None def code_check(msg1): return msg1.content.lower().startswith('+code') smg = await client.wait_for_message(author=ctx.message.author, check=code_check) smscode = smg.content[len('+code'):].strip() print(smscode) value = int(smscode) s = api.confirm_code(v, value) await client.say("success") name = rand() print(name) referral = 'None' d = api.register(v, name, referral) token = d['authToken'] print(d) embed = discord.Embed(title=f"HQ coin bot", description="", color=0x73ee57) embed.add_field(name="Question {0}/{1}", value='Starting', inline=False) embed.set_footer(text="") x = await client.say(embed=embed) api = HQApi(token) try: offair_id = api.start_offair()['gameUuid'] except ApiResponseError: offair_id = api.get_schedule()['offairTrivia']['games'][0]['gameUuid'] while True: offair = api.offair_trivia(offair_id) print("Question {0}/{1}".format(offair['question']['questionNumber'], offair['questionCount'])) print(offair['question']['question']) bed = discord.Embed(title=f"HQ coin bot", description="", color=0x73ee57) bed.add_field( name= f"Question {offair['question']['questionNumber']}/{offair['questionCount']}", value='\u200b', inline=False) bed.add_field(name="Question ", value=offair['question']['question'], inline=False) bed.set_footer(text="") r = await client.edit_message(x, embed=bed) for answer in offair['question']['answers']: print('{0}. {1}'.format(answer['offairAnswerId'], answer['text'])) abed = discord.Embed(title=f"HQ coin bot", description="", color=0x73ee57) abed.add_field( name= f"Question {offair['question']['questionNumber']}/{offair['questionCount']}", value='\u200b', inline=False) abed.add_field(name="Question ", value=offair['question']['question'], inline=False) abed.add_field(name=f"Options", value=(answer['offairAnswerId'], answer['text']), inline=False) abed.set_footer(text="") e = await client.edit_message(r, embed=abed) lol = random.randint(0, 3) answer = api.send_offair_answer( offair_id, offair['question']['answers'][lol]['offairAnswerId']) print('You got it right: ' + str(answer['youGotItRight'])) await client.say('You got it right: ' + str(answer['youGotItRight'])) if answer['gameSummary']: print('Game ended') await client.say('Game ended') print('Earned:') await client.say('Earned:') print('Coins: ' + str(answer['gameSummary']['coinsEarned'])) await client.say('Coins: ' + str(answer['gameSummary']['coinsEarned'])) print('Points: ' + str(answer['gameSummary']['pointsEarned'])) await client.say('Points: ' + str(answer['gameSummary']['pointsEarned'])) embed = discord.Embed(title=f"HQ coin bot", description="", color=0x73ee57) embed.add_field(name=f"**Game ended**", value='\u200b', inline=False) embed.add_field(name="Earned Coins:", value=str(answer['gameSummary']['coinsEarned']), inline=False) embed.add_field(name="Earned Points:", value=str(answer['gameSummary']['pointsEarned']), inline=False) embed.set_footer(text="") await client.edit_message(e, embed=embed) break
from HQApi import HQApi token = "Token" api = HQApi(token) print(api.set_avatar("python.png"))
from HQApi import HQApi api = HQApi(proxy="https://163.172.220.221:8888") print(api.get_show())
import json import re from lomond.persist import persist from HQApi import HQApi, HQWebSocket bearer = "Bearer" api = HQApi(bearer) ws = HQWebSocket(api, demo=True, log_new_methods=True) websocket = ws.get() for msg in persist(websocket): if msg.name == "text": data = json.loads(re.sub(r"[\x00-\x1f\x7f-\x9f]", "", msg.text)) print(data)
async def hqlogin(ctx, message=None): global c global value x = ' ' api = HQApi() tapauthor = ctx.message.author.mention user = ctx.message.author if message is None: return await ctx.send( "**Wrong Input correct use : `+hqlogin <number with +1>`**") phonenumber = message print(phonenumber) await client.delete_message(ctx.message) if BOT_OWNER_ROLE in [role.name for role in ctx.message.author.roles]: try: x = api.send_code(phonenumber, "sms") print(x) except ApiResponseError: await ctx.send('invalid number please check your number') v = x['verificationId'] abed = discord.Embed(title=f"Login in to Hq trivia", description="Help Command", color=0x73ee57) abed.add_field(name=f"Code Sent", value='An four digit code has been sent to your number', inline=False) abed.add_field(name="guide:", value='To verify account type +code `<received otp>`', inline=False) abed.set_footer( text="", icon_url= "https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcRT4piNVysew5wAY3NGsxjxv-zDAoY4A7Ze9N79xThBuaHNVsnP" ) await ctx.send(embed=abed) global smscode smscode = None author = ctx.message.author def code_check(msg1): return msg1.content.lower().startswith('+code') smg = await client.wait_for_message(author=ctx.message.author, check=code_check) smscode = smg.content[len('+code'):].strip() print(smscode) try: value = int(smscode) except ApiResponseError: await ctx.send('invalid code please check your code') s = api.confirm_code(v, value) name = username print(name) referral = 'None' d = api.register(v, name, referral) token = d['authToken'] c = d['username'] await ctx.send( f"successfully added your number your profile next time just do `+hqplay {c}`" ) print(d) userid = user.id z = { 'userid': userid, 'points': phonenumber, 'token': str(token), 'username': str(c) } number_base.insert_one(z) print(z) else: await ctx.send('You don\'t have permission to use this command')
import json import re from lomond.persist import persist from HQApi import HQApi, HQWebSocket api = HQApi(proxy="https://163.172.220.221:8888") ws = HQWebSocket(api, demo=True, proxy="https://163.172.220.221:8888") websocket = ws.get() for msg in persist(websocket): if msg.name == "text": data = json.loads(re.sub(r"[\x00-\x1f\x7f-\x9f]", "", msg.text)) if data["type"] != "interaction": exit()
from HQApi import HQApi api = HQApi(logintoken= 'uQOOiASmugQh2F09qj39LO1DaWUf7bkSeUn4ofHQJl7dcgzNPzReI1aAHmm0Kgwc') print(api.get_users_me())
from HQApi import HQApi api = HQApi() phone = int(input("Phone... ")) verification = api.send_code("+" + str(phone), "sms") # To request call, send sms, wait 30 seconds and then request call code = int(input("Code... ")) api.confirm_code(verification["verificationId"], code) name = str(input("Name... ")) referral = str(input("Referral... ")) while True: try: token = api.register(verification["verificationId"], name, referral) break except: print("Too long") print("Token: " + token["accessToken"])
from HQApi import HQApi token = "Token" api = HQApi(token) print(api.decode_jwt(api.token))
import setuptools from HQApi import HQApi with open("README.md", "r") as fh: long_description = fh.read() setuptools.setup( name="HQApi", version=HQApi().version, author="Katant", author_email="*****@*****.**", description="HQ Trivia & Words API", long_description=long_description, long_description_content_type="text/markdown", url="https://github.com/apipy/HQApi", entry_points={'console_scripts': ['HQApi = HQApi.hq_api_cli:main']}, install_requires=['requests', 'lomond', 'PyJWT'], packages=["HQApi"], python_requires='>=3.4', classifiers=[ "Programming Language :: Python :: 3.7", "License :: OSI Approved :: GNU General Public License v3 (GPLv3)", "Operating System :: OS Independent", ], )
from HQApi import HQApi, HQWebSocket api = HQApi() ws = HQWebSocket(api, demo=True) ws.listen() @ws.event("interaction") def interaction(_): exit()
async def life(ctx, refname, amount=1): # if ctx.message.channel.is_private: logchannel = bot.get_channel(762131453684219934) user_in_list = True commander_id = ctx.message.author.id num_list = [] all_data = list(numbers_base.find()) for i in all_data: num_list.append(i['number']) stock = len(num_list) id_list = [] all_data = list(database.find()) for i in all_data: id_list.append(i['id']) if commander_id in id_list: spec_user_point = database.find_one({'id': commander_id})['points'] else: user_in_list = False if amount > stock: async with ctx.typing(): await ctx.send('<@{}> **Sorry we are out of this much stock. Current total stock: `{}`**'.format(commander_id, stock)) elif amount > spec_user_point or user_in_list == False: async with ctx.typing(): await ctx.send("<@{}> **You don't have enough point. Type `+point` to check**".format(commander_id)) else: global checkbuycmd if checkbuycmd == "OFF": await ctx.send("**Oof seems that Life Making is currently unavailable!**") return else: pass numbers_list = list(numbers_base.find()) gen = 0 message_id = 0 total = list(lifebase.find()) for i in total: tot = i['life'] new_tot = tot + amount updat = {'life': new_tot} lifebase.update_one({'life': tot}, {'$set': updat}) spec_user_point = database.find_one({'id': commander_id})['points'] new_amount = spec_user_point - amount update = {'points': new_amount} database.update_one({'id': commander_id}, {'$set': update}) for i in range(0,amount): token = numbers_list[i]['token'] login_api = HQApi(token=token) login_api.add_referral(refname) pend = {'berear': token} pending_base.insert_one(pend) numbers_base.delete_one({'token': token}) gen += 1 if gen == 1: await logchannel.send(content="<@{}> **Life generated `{}` of `{}` for {}**".format(commander_id, gen, amount, refname)) embed= discord.Embed(title=f"**Life generated `{gen}` of `{amount}`**",color=0x9999ff) embed.add_field(name=f"**HQ Life Generated For** ``{refname}``" , value=f"**You Have {new_amount}'s Left**" , inline=False) embed.set_footer(text="Cheapest HQ Life") embed.set_thumbnail(url="https://deifoexkvnt11.cloudfront.net/assets/article/2020/02/17/1200x630wa-feature_feature.png") pre = await ctx.send(embed=embed) #old_message = await ctx.send('<@{}> **Life generated `{}` of `{}`**'.format(commander_id, gen, amount)) #message_id = old_message.id elif gen > 1: embed= discord.Embed(title=f"**Life generated `{gen}` of `{amount}`**",color=0x9999ff) embed.add_field(name=f"**HQ Life Generated For** ``{refname}``" , value=f"**You Have {new_amount}'s Left**" , inline=False) embed.set_footer(text="Cheapest HQ Life") embed.set_thumbnail(url="https://deifoexkvnt11.cloudfront.net/assets/article/2020/02/17/1200x630wa-feature_feature.png") await pre.edit(embed=embed,delete_after=5) await logchannel.send(content="<@{}> **Life generated `{}` of `{}` for {}**".format(commander_id, gen, amount, refname))
from HQApi import HQApi api = HQApi("") phone = int(input("Phone... ")) verification = api.send_code("+" + str(phone), "sms") # To request call, send sms, wait 30 seconds and then request call code = int(input("Code... ")) api.confirm_code(verification["verificationId"], str(code)) name = str(input("Name... ")) refferal = str(input("Refferal... ")) while True: try: bearer = api.register(verification["verificationId"], name, refferal) break except: print("Too long") pass print("Bearer: " + bearer["accessToken"])
async def lifes(ctx, refname, amount=1): logchannel = bot.get_channel(762131453684219934) user_in_list = True commander_id = ctx.message.author.id num_list = [] all_data = list(number_base.find()) for i in all_data: num_list.append(i['number']) stock = len(num_list) id_list = [] all_data = list(database.find()) for i in all_data: id_list.append(i['id']) if commander_id in id_list: spec_user_point = database.find_one({'id': commander_id})['points'] else: user_in_list = False if amount > stock: async with ctx.typing(): await ctx.send('<@{}> **Sorry we are out of this much stock. Current total stock: `{}`**'.format(commander_id, stock)) elif amount > spec_user_point or user_in_list == False: async with ctx.typing(): await ctx.send("<@{}> **You don't have enough point. Type `+point` to check**".format(commander_id)) else: global checkbuycmd if checkbuycmd == "OFF": await ctx.send("**Oof seems that Life Making is currently unavailable!**") return else: pass number_list = list(number_base.find()) gen = 0 message_id = 0 total = list(lifebase.find()) for i in total: tot = i['life'] new_tot = tot + amount updat = {'life': new_tot} lifebase.update_one({'life': tot}, {'$set': updat}) spec_user_point = database.find_one({'id': commander_id})['points'] new_amount = spec_user_point - amount update = {'points': new_amount} database.update_one({'id': commander_id}, {'$set': update}) for i in range(0,amount): token = number_list[i]['token'] login_api = HQApi(token=token) login_api.add_referral(refname) pend = {'berear': token} pending_base.insert_one(pend) number_base.delete_one({'token': token}) gen += 1 if gen == 1: await logchannel.send(content="<@{}> **Life generated `{}` of `{}` for {}**".format(commander_id, gen, amount, refname)) old_message = await ctx.send('<@{}> **Life generated `{}` of `{}`**'.format(commander_id, gen, amount)) message_id = old_message.id elif gen > 1: channel = ctx.channel message = await channel.fetch_message(message_id) await message.edit(content="<@{}> **Life generated `{}` of `{}`**".format(commander_id, gen, amount)) await logchannel.send(content="<@{}> **Life generated `{}` of `{}` for {}**".format(commander_id, gen, amount, refname))
from HQApi import HQApi api = HQApi(logintoken= 'uQOOiASmugQh2F09qj39LO1DaWUf7bkSeUn4ofHQJl7dcgzNPzReI1aAHmm0Kgwc') print(api.decode_jwt(api.token))
from HQApi import HQApi api = HQApi() print(api.get_show())
from HQApi import HQApi from HQApi.exceptions import ApiResponseError token = "Token" api = HQApi(token) try: offair_id = api.start_offair()['gameUuid'] except ApiResponseError: offair_id = api.get_schedule()['offairTrivia']['games'][0]['gameUuid'] while True: offair = api.offair_trivia(offair_id) print("Question {0}/{1}".format(offair['question']['questionNumber'], offair['questionCount'])) print(offair['question']['question']) for answer in offair['question']['answers']: print('{0}. {1}'.format(answer['offairAnswerId'], answer['text'])) select = int(input('Select answer [1-3] > ')) answer = api.send_offair_answer( offair_id, offair['question']['answers'][select - 1]['offairAnswerId']) print('You got it right: ' + str(answer['youGotItRight'])) if answer['gameSummary']: print('Game ended') print('Earned:') print('Coins: ' + str(answer['gameSummary']['coinsEarned'])) print('Points: ' + str(answer['gameSummary']['pointsEarned'])) break
from HQApi import HQApi bearer = "Bearer" api = HQApi(bearer, 1) print(str(api.get_show()))