steamutils 1.4.46 → 1.4.47

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 +41 -5
  2. package/package.json +1 -1
package/SteamClient.js CHANGED
@@ -106,6 +106,9 @@ function SteamClient({ username, password, cookie, clientJsToken, isAutoRequestF
106
106
  let lastTimePartySearch = 0;
107
107
  const ownedApps = [];
108
108
  let logOffEvent = null;
109
+ let _cleanNodeSteamUserTimeout = null;
110
+ let _cleanNodeSteamLicensesTimeout = null;
111
+ let _cleanNodeSteamFriendTimeout = null;
109
112
 
110
113
  let _clientWelcome = null;
111
114
  let _clientHello = null;
@@ -1295,9 +1298,7 @@ function SteamClient({ username, password, cookie, clientJsToken, isAutoRequestF
1295
1298
  async user(steamId, data) {
1296
1299
  callEvent(events.user, { steamId: steamId.getSteamID64(), data });
1297
1300
 
1298
- for (const friendSteamId in steamClient.users) {
1299
- steamClient.users[friendSteamId] = {};
1300
- }
1301
+ _cleanNodeSteamUserData();
1301
1302
 
1302
1303
  const dataExample = {
1303
1304
  rich_presence: [
@@ -1435,7 +1436,12 @@ function SteamClient({ username, password, cookie, clientJsToken, isAutoRequestF
1435
1436
  callEvent(events.friendsList, getFriendList());
1436
1437
 
1437
1438
  steamClient.myFriends = {};
1438
- setTimeout(function () {
1439
+
1440
+ if (_cleanNodeSteamFriendTimeout) {
1441
+ clearTimeout(_cleanNodeSteamFriendTimeout);
1442
+ }
1443
+
1444
+ _cleanNodeSteamFriendTimeout = setTimeout(function () {
1439
1445
  steamClient.myFriends = {};
1440
1446
  }, 10000);
1441
1447
  },
@@ -1483,7 +1489,12 @@ function SteamClient({ username, password, cookie, clientJsToken, isAutoRequestF
1483
1489
  },
1484
1490
  async licenses() {
1485
1491
  steamClient.licenses = [];
1486
- setTimeout(function () {
1492
+
1493
+ if (_cleanNodeSteamLicensesTimeout) {
1494
+ clearTimeout(_cleanNodeSteamLicensesTimeout);
1495
+ }
1496
+
1497
+ _cleanNodeSteamLicensesTimeout = setTimeout(function () {
1487
1498
  steamClient.licenses = [];
1488
1499
  }, 10000);
1489
1500
  },
@@ -1788,6 +1799,19 @@ function SteamClient({ username, password, cookie, clientJsToken, isAutoRequestF
1788
1799
  function logOff() {
1789
1800
  isLogOff = true;
1790
1801
  logOffEvent?.(true);
1802
+ if (_cleanNodeSteamUserTimeout) {
1803
+ clearTimeout(_cleanNodeSteamUserTimeout);
1804
+ }
1805
+ if (_cleanNodeSteamLicensesTimeout) {
1806
+ clearTimeout(_cleanNodeSteamLicensesTimeout);
1807
+ }
1808
+ if (_cleanNodeSteamFriendTimeout) {
1809
+ clearTimeout(_cleanNodeSteamFriendTimeout);
1810
+ }
1811
+ steamClient.users = {};
1812
+ steamClient.myFriends = {};
1813
+ steamClient.licenses = [];
1814
+
1791
1815
  steamClient.logOff();
1792
1816
  }
1793
1817
 
@@ -2277,6 +2301,18 @@ function SteamClient({ username, password, cookie, clientJsToken, isAutoRequestF
2277
2301
  );
2278
2302
  }
2279
2303
 
2304
+ function _cleanNodeSteamUserData() {
2305
+ for (const friendSteamId in steamClient.users) {
2306
+ steamClient.users[friendSteamId] = {};
2307
+ }
2308
+ if (_cleanNodeSteamUserTimeout) {
2309
+ clearTimeout(_cleanNodeSteamUserTimeout);
2310
+ }
2311
+ setTimeout(function () {
2312
+ steamClient.users = {};
2313
+ }, 60000);
2314
+ }
2315
+
2280
2316
  return {
2281
2317
  init,
2282
2318
  partySearch,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "steamutils",
3
- "version": "1.4.46",
3
+ "version": "1.4.47",
4
4
  "main": "index.js",
5
5
  "dependencies": {
6
6
  "alpha-common-utils": "^1.0.6",