From 0a9964c22def24b31a130914dd6cef74f713ebd9 Mon Sep 17 00:00:00 2001 From: seria Date: Mon, 9 Dec 2024 20:23:57 +0900 Subject: [PATCH] feat: Add get_mimo_point_count method --- genshin/client/components/hoyolab.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/genshin/client/components/hoyolab.py b/genshin/client/components/hoyolab.py index 4c446086..6c362e3a 100644 --- a/genshin/client/components/hoyolab.py +++ b/genshin/client/components/hoyolab.py @@ -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, @@ -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