Beispiel #1
0
    async def abyss(self, ctx):
        #try:
        cookies = get_cookies(ctx.author.id)
        gs.set_cookie(ltuid=cookies[1], ltoken=cookies[2])

        uid = get_uid(ctx.author.id)
        spiral_abyss = gs.get_spiral_abyss(uid, previous=True)
        stats = spiral_abyss['stats']
        for field, value in stats.items():
            await ctx.send(f'{field}: {value}')
Beispiel #2
0
 def test_cookie(self):
     gs.set_cookies()  # equivalent to gs.cookies.clear()
     self.assertEqual(gs.genshinstats.cookies, [])
     gs.set_cookies('header1', 'header2')
     self.assertEqual(len(gs.genshinstats.cookies), 2)
     cookie = dict(ltuid=os.environ['GS_LTUID'],
                   ltoken=os.environ['GS_LTOKEN'])
     gs.set_cookie(cookie)
     expected = gs.genshinstats.RequestsCookieJar()
     expected.update(cookie)
     self.assertEqual(gs.genshinstats.cookies[0], cookie)
import genshinstats as gs
import os
gs.set_cookie(ltuid=int(os.environ.get('LTUID')),
              ltoken=os.environ.get('LTOKEN'))

info = gs.get_daily_reward_info()
print('total rewards claimed:', info[1])
print("Get Reward :", gs.claim_daily_reward()
      )  # signed you in, returns a bool whether it succeeded
info = gs.get_daily_reward_info()
print('total rewards claimed:', info[1])  # check-in completed if increased
import genshinstats as gs

gs.set_cookie(ltuid=..., ltoken=...)

uid = input('Please enter a uid: ')
action = input(
    'What would you like to view? [1. stats, 2. characters, 3. spiral abyss] ')

if action == '1':
    print(f'Getting stats for {uid}...\n')
    data = gs.get_user_info(uid)

    print(f"\nstats: ")
    for field, value in data['stats'].items():
        print(f"{field.replace('_',' ')}: {value}")
    print(f"\nexplorations: ")
    for area in data['explorations']:
        print(
            f"{area['name']}: explored {area['explored']}% | {area['type']} level {area['level']}"
        )

elif action == '2':
    print(f'Getting characters for {uid}...\n')
    data = gs.get_all_characters(uid)

    data.sort(key=lambda x: (x['rarity'], x['level']), reverse=True)
    for char in data:
        print(
            f"{char['name']} ({char['rarity']}* {char['element']}): lvl {char['level']} C{char['constellation']}"
        )
Beispiel #5
0
 def setUpClass():
     gs.set_cookie(ltuid=os.environ['GS_LTUID'],
                   ltoken=os.environ['GS_LTOKEN'])
Beispiel #6
0
def set_cookie():
    gs.set_cookie(ltuid=os.environ["CN_LTUID"], ltoken=os.environ["CN_LTOKEN"])
Beispiel #7
0
import genshinstats as gs
import os
gs.set_cookie(account_id=int(os.environ.get('ACCOUNT_ID')),
              cookie_token=os.environ.get('COOKIE_TOKEN'))

info = gs.get_daily_reward_info()
print('total rewards claimed:', info['total_sign_day'])
print(gs.sign_in())  # signed you in, returns a bool whether it succeeded
info = gs.get_daily_reward_info()
print('total rewards claimed:',
      info['total_sign_day'])  # check-in completed if increased
import genshinstats as gs

gs.set_cookie(account_id=..., cookie_token=...)

uid = input('Please enter a uid: ')
action = input(
    'What would you like to view? [1. stats, 2. characters, 3. spiral abyss] ')

if action == '1':
    print(f'Getting stats for {uid}...\n')
    data = gs.get_user_info(uid)

    print(f"\nstats: ")
    for field, value in data['stats'].items():
        print(f"{field.replace('_',' ')}: {value}")
    print(f"\nexplorations: ")
    for area in data['explorations']:
        print(
            f"{area['name']}: explored {area['explored']}% | {area['type']} level {area['level']}"
        )

elif action == '2':
    print(f'Getting characters for {uid}...\n')
    data = gs.get_all_characters(uid)

    data.sort(key=lambda x: (x['rarity'], x['level']), reverse=True)
    for char in data:
        print(
            f"{char['name']} ({char['rarity']}* {char['element']}): lvl {char['level']} C{char['constellation']}"
        )