steamutils 1.2.99 → 1.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/SteamClient.js +6 -4
  2. package/package.json +1 -1
package/SteamClient.js CHANGED
@@ -344,11 +344,11 @@ function SteamClient({
344
344
  let ownedApps = []
345
345
  for (let i = 0; i < 5; i++) {
346
346
  ownedApps = await getUserOwnedApps()
347
- if (ownedApps.length) {
347
+ if (ownedApps?.length) {
348
348
  break
349
349
  }
350
350
  }
351
- if (!ownedApps.length) {
351
+ if (!ownedApps?.length) {
352
352
  gamesPlayed(730)
353
353
  } else {
354
354
  ownedApps = ownedApps.map(({appid}) => appid)
@@ -1468,9 +1468,11 @@ function SteamClient({
1468
1468
  }
1469
1469
 
1470
1470
  async function autoRequestFreeLicense(shouldLog = false, max = 10) {
1471
+ return
1471
1472
  // const mCookies = await getCookiesWait()
1472
1473
  // if (!mCookies) return
1473
- const freeAppList = Array.isArray(steamClient.licenses) ? FreeAppList.filter(appId => steamClient.licenses.every(({package_id}) => package_id !== appId)) : FreeAppList;
1474
+ // let freeAppList = Array.isArray(steamClient.licenses) ? FreeAppList.filter(appId => steamClient.licenses.every(({package_id}) => package_id !== appId)) : FreeAppList;
1475
+ const freeAppList = freeAppList.filter(appId => ownedApps.some(app => app.appid == appId))
1474
1476
  const recommendedApps = _.shuffle(freeAppList)
1475
1477
  if (max) {
1476
1478
  recommendedApps.length = Math.min(recommendedApps.length, max)
@@ -1670,7 +1672,7 @@ function SteamClient({
1670
1672
 
1671
1673
  async function getUserOwnedApps(steamId = steamClient.steamID) {
1672
1674
  if (!steamId) {
1673
- return
1675
+ return []
1674
1676
  }
1675
1677
  if (typeof steamId?.getSteamID64 === "function") {
1676
1678
  steamId = steamId.getSteamID64()
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "steamutils",
3
- "version": "1.2.99",
3
+ "version": "1.3.01",
4
4
  "main": "index.js",
5
5
  "dependencies": {
6
6
  "axios": "^1.5.1",