mirror of
https://github.com/maxswa/osrs-json-hiscores.git
synced 2025-10-15 10:19:04 +00:00
Fix RSN format errors, add mode.
This commit is contained in:
@@ -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();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user