steamutils 1.4.3 → 1.4.4
Sign up to get free protection for your applications and to get access to all the features.
- package/SteamClient.js +7 -7
- package/index.js +7350 -7350
- package/package.json +1 -1
package/SteamClient.js
CHANGED
@@ -297,23 +297,23 @@ function SteamClient({ username, password, cookie, clientJsToken, isAutoRequestF
|
|
297
297
|
}
|
298
298
|
|
299
299
|
async function getPersonas(steamIDs) {
|
300
|
-
|
301
|
-
const
|
302
|
-
const cachedPersonas = PersonasCache.filter((p) =>
|
300
|
+
const idsToFetch = steamIDs.map((steamId) => (steamId instanceof SteamID ? steamId.getSteamID64() : steamId));
|
301
|
+
const notCachedIDs = idsToFetch.filter((id) => !PersonasCache.some((p) => p.id == id));
|
302
|
+
const cachedPersonas = PersonasCache.filter((p) => idsToFetch.includes(p.id));
|
303
303
|
|
304
|
-
if (
|
304
|
+
if (notCachedIDs.length) {
|
305
305
|
let personas = null;
|
306
306
|
try {
|
307
|
-
personas = (await steamClient.getPersonas(
|
307
|
+
personas = (await steamClient.getPersonas(notCachedIDs))?.personas;
|
308
308
|
} catch (e) {}
|
309
309
|
if (!personas || !Object.keys(personas).length) {
|
310
310
|
try {
|
311
|
-
personas = (await steamClient.getPersonas(
|
311
|
+
personas = (await steamClient.getPersonas(notCachedIDs))?.personas;
|
312
312
|
} catch (e) {}
|
313
313
|
}
|
314
314
|
if (!personas || !Object.keys(personas).length) {
|
315
315
|
try {
|
316
|
-
personas = (await steamClient.getPersonas(
|
316
|
+
personas = (await steamClient.getPersonas(notCachedIDs))?.personas;
|
317
317
|
} catch (e) {}
|
318
318
|
}
|
319
319
|
if (personas && Object.keys(personas).length) {
|