From 02c5db90f43327816b6bc8e331397eda7805e96d Mon Sep 17 00:00:00 2001 From: NiceAesth Date: Sat, 16 Nov 2024 17:33:03 +0200 Subject: [PATCH] feat: change scopes for replay downloading --- aiosu/v2/client.py | 27 +++++++++++++++++++++++---- 1 file changed, 23 insertions(+), 4 deletions(-) diff --git a/aiosu/v2/client.py b/aiosu/v2/client.py index 190993b..6e90d5e 100644 --- a/aiosu/v2/client.py +++ b/aiosu/v2/client.py @@ -1819,19 +1819,38 @@ async def get_score_lazer( @prepare_token @check_token @requires_scope(Scopes.PUBLIC) - @requires_scope(Scopes.IDENTIFY | Scopes.DELEGATE, any_scope=True) async def get_score_replay( self, - score_id: int, + legacy_score_id: int, mode: Gamemode, ) -> BytesIO: r"""Gets the replay file for a score. - :param score_id: The ID of the score - :type score_id: int + :param legacy_score_id: The ID of the score + :type legacy_score_id: int :param mode: The gamemode to search for :type mode: aiosu.models.gamemode.Gamemode + :raises APIException: Contains status code and error message + :raises RefreshTokenExpiredError: If the client refresh token has expired + :return: Replay file + :rtype: io.BytesIO + """ + url = f"{self.base_url}/api/v2/scores/{mode}/{legacy_score_id}/download" + return await self._request("GET", url) + + @prepare_token + @check_token + @requires_scope(Scopes.PUBLIC) + async def get_score_replay_lazer( + self, + score_id: int, + ) -> BytesIO: + r"""Gets the replay file for a score. + + :param score_id: The ID of the score + :type score_id: int + :raises APIException: Contains status code and error message :raises RefreshTokenExpiredError: If the client refresh token has expired :return: Replay file