Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate to New Game Record API #205

Merged
merged 1 commit into from
Jul 7, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 1 addition & 9 deletions genshin/client/components/chronicle/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,15 +43,10 @@ async def request_game_record(
*,
lang: typing.Optional[str] = None,
region: typing.Optional[types.Region] = None,
game: typing.Optional[types.Game] = None,
**kwargs: typing.Any,
) -> typing.Mapping[str, typing.Any]:
"""Make a request towards the game record endpoint."""
base_url = routes.RECORD_URL.get_url(region or self.region)

if game:
base_url = base_url / game.value / "api"

url = base_url / endpoint

mi18n_task = asyncio.create_task(self._fetch_mi18n("bbs", lang=lang or self.lang))
Expand Down Expand Up @@ -117,9 +112,6 @@ async def update_settings(
2: Show your Character Details in the Battle Chronicle.
3: Enable your Real-Time Notes. (only for Genshin Impact)
"""
if game is types.Game.STARRAIL or self.default_game is types.Game.STARRAIL:
raise RuntimeError("Star Rail does not provide a Battle Chronicle or Real-Time Notes.")

if game is None and int(setting) == 3:
game = types.Game.GENSHIN

Expand All @@ -129,7 +121,7 @@ async def update_settings(

game = self.default_game

game_id = {types.Game.HONKAI: 1, types.Game.GENSHIN: 2, types.Game.STARRAIL: 6}[game]
game_id = {types.Game.HONKAI: 1, types.Game.GENSHIN: 2, types.Game.STARRAIL: 6, types.Game.ZZZ: 8}[game]

await self.request_game_record(
"card/wapi/changeDataSwitch",
Expand Down
Loading