thesadru / genshinstats

PLEASE USE GENSHIN.PY A python library that can get the stats of Genshin Impact players using Mihoyo's API. PLEASE USE GENSHIN.PY
https://thesadru.github.io/pdoc/genshinstats/
MIT License
268 stars 38 forks source link

HoYoLab Check In and Daily Reward Redemption Fails for Multiple Accounts #13

Closed KingWaffleIII closed 3 years ago

KingWaffleIII commented 3 years ago

I'm making a "Genshin companion" Discord bot and during boot of the bot, it uses set_cookies() to log in multiple users whose tokens and IDs are stored at once. However, when I try to check in and claim the daily rewards, it only works for the first user in the database rather than all of them. Is it possible to make it work for all accounts?

The same thing happens with get_game_accounts(); only works for the first user in the database.

thesadru commented 3 years ago

That's because this project is not meant to work with multiple users at once. The cookies are meant to overcome ratelimits, not be used for multiple users. I'm thinking that a possible solution to this is to add an optional parameter to these kinds of functions which depend on the logged-in user. This should also make it possible to do batch jobs with some simple threading. If you have other ideas feel free to say them, otherwise I'll try to implement what I just said.

thesadru commented 3 years ago

This bug has been fixed with cdb58ce9d94fb5e54d8226b5fbb9fb887228c673. You can now use a cookie parameter in claim_daily_rewards(cookie={...}), get_game_accounts(cookie={...}) and many others to use that cookie instead of the global one set by set_cookies.