Skip to content

Commit fb17edc

Browse files
committed
feat: support id in minfo
1 parent aafda3a commit fb17edc

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

maimai_py/maimai.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -929,6 +929,9 @@ async def minfo(
929929
ArcadeIdentifierError: Only for ArcadeProvider, maimai user id is invalid, or the user is not found.
930930
"""
931931
maimai_songs, scores = await self.songs(), []
932+
if isinstance(song, str) and song.isdecimal():
933+
search_result = await maimai_songs.by_id(int(song))
934+
song = search_result if search_result is not None else song
932935
if isinstance(song, str):
933936
search_result = await maimai_songs.by_keywords(song)
934937
song = search_result[0] if len(search_result) > 0 else song

tests/test_scores.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ async def test_scores_fetching_divingfish(maimai: MaimaiClient, divingfish: Divi
3939
assert my_scores.rating == bests.rating
4040
assert len(bests.scores_b15) <= 15
4141

42-
preview = await maimai.minfo(1231, PlayerIdentifier(username="turou"), provider=divingfish)
42+
preview = await maimai.minfo("1231", PlayerIdentifier(username="turou"), provider=divingfish)
4343
assert preview is not None
4444
assert all(score.id == preview.song.id for score in preview.scores)
4545

0 commit comments

Comments
 (0)