Skip to content

Commit

Permalink
Migrate to new game record API (#205)
Browse files Browse the repository at this point in the history
  • Loading branch information
seriaati committed Jul 7, 2024
1 parent 9d0277b commit 06d19c0
Showing 1 changed file with 1 addition and 9 deletions.
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

0 comments on commit 06d19c0

Please sign in to comment.