Fix RSN format errors, add mode.

This commit is contained in:
maxswa
2025-02-24 19:41:27 -05:00
parent fd24890f67
commit 7d7c7f9b08
2 changed files with 26 additions and 6 deletions

View File

@@ -86,11 +86,12 @@ export async function getOfficialStats(
*/
export async function getRSNFormat(
rsn: string,
config?: AxiosRequestConfig
config?: AxiosRequestConfig,
mode: Gamemode = 'main'
): Promise<string> {
validateRSN(rsn);
const url = getPlayerTableURL('main', rsn);
const url = getPlayerTableURL(mode, rsn);
try {
const response = await httpGet<string | Buffer | BinaryData | undefined>(
url,
@@ -103,10 +104,10 @@ export async function getRSNFormat(
if (anchor) {
return rsnFromElement(anchor);
}
throw new PlayerNotFoundError();
} catch {
throw new HiScoresError();
}
throw new PlayerNotFoundError();
}
/**