This commit is contained in:
seditionist
2023-08-17 00:58:37 -04:00
parent 97532b0c03
commit 5483e54d78

View File

@@ -289,22 +289,21 @@ export async function getStats(
const main = await getOfficialStats(rsn, 'main', options?.axiosConfigs?.main);
const emptyResponse: HiscoresResponse = {
skills: [],
activities: []
};
const getModeStats = async (
mode: Extract<Gamemode, 'ironman' | 'hardcore' | 'ultimate'>
): Promise<HiscoresResponse | undefined> => {
if (!otherGamemodes.includes(mode)) {
return { skills: [], activities: [] };
}
try {
return await getOfficialStats(rsn, mode, options?.axiosConfigs?.[mode]);
} catch {
return undefined;
}
};
): Promise<HiscoresResponse | undefined> =>
otherGamemodes.includes(mode)
? getOfficialStats(rsn, mode, options?.axiosConfigs?.[mode])
.catch(err => err)
: emptyResponse;
const formattedName = shouldGetFormattedRsn
? await getRSNFormat(rsn, options?.axiosConfigs?.rsn).catch(() => undefined)
? await getRSNFormat(rsn, options?.axiosConfigs?.rsn).catch(
() => undefined
)
: undefined;
const player: Player = {