sanjaybaskaran01 / Valorina

Discord 🤖 to never miss a Valorant skin drop!
https://discord.com/oauth2/authorize?client_id=888741654482272276&permissions=2147739648&scope=bot
MIT License
35 stars 12 forks source link

[FEATURE] Night Market #11

Open SavvyxArhum opened 2 years ago

SavvyxArhum commented 2 years ago

Is your feature request related to a problem? Please describe. A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

Describe the solution you'd like A clear and concise description of what you want to happen.

Describe alternatives you've considered A clear and concise description of any alternative solutions or features you've considered.

Additional context Add any other context or screenshots about the feature request here.

github-actions[bot] commented 2 years ago

👋 Thanks for reporting!

sanjaybaskaran01 commented 2 years ago

For people willing to work on the Issue, Riot sends the night market as an additional item to the object present here called "BonusStore", make sure to style the embed similar to the current +store embed, create a new additional command called +nightmarket in here , create an additional function for nightmarket in getSkinOffers.py

async def getStore(headers, user_id, region, nightMarket=False):
    session = aiohttp.ClientSession()
    try:
        async with session.get(f'https://pd.{region}.a.pvp.net/store/v2/storefront/{user_id}', headers=headers) as r:
            data = json.loads(await r.text())
    except Exception as e:
        print(e)
    finally:
        await session.close()
    if nightMarket:
        if 'BonusStore' not in data:
            return 404 # if "BonusStore" is not present in the object send a different response letting people know nightmarket is not enabled
        nightMarketPanel = data['BonusStore']
        return await getNightMarket(headers, nightMarketPanel, region)
    if 'SkinsPanelLayout' not in data:
        return
    skinPanel = data['SkinsPanelLayout']
    return await getSkinDetails(headers, skinPanel, region)