Skip to content

Commit

Permalink
feat: Add get_mimo_point_count method
Browse files Browse the repository at this point in the history
  • Loading branch information
seriaati committed Dec 9, 2024
1 parent 5413c27 commit 0a9964c
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions genshin/client/components/hoyolab.py
Original file line number Diff line number Diff line change
Expand Up @@ -349,6 +349,7 @@ async def get_mimo_shop_items(
)
return [models.MimoShopItem(**i) for i in data["exchange_award_list"]]

@base.region_specific(types.Region.OVERSEAS)
async def buy_mimo_shop_item(
self,
item_id: int,
Expand All @@ -366,3 +367,17 @@ async def buy_mimo_shop_item(
method="POST",
)
return data["exchange_code"]

@base.region_specific(types.Region.OVERSEAS)
async def get_mimo_point_count(
self,
*,
game: typing.Optional[typing.Union[typing.Literal["hoyolab"], types.Game]] = None,
) -> int:
"""Get the current Traveling Mimo point count."""
game = game or self.default_game
games = await self.get_mimo_games()
mimo_game = next((i for i in games if i.game == game), None)
if mimo_game is None:
raise ValueError(f"Game {game!r} not found in the list of Traveling Mimo games.")
return mimo_game.point

0 comments on commit 0a9964c

Please sign in to comment.