steamutils 1.4.46 → 1.4.48

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. package/SteamClient.js +35 -2
  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,16 @@ function SteamClient({ username, password, cookie, clientJsToken, isAutoRequestF
1295
1298
  async user(steamId, data) {
1296
1299
  callEvent(events.user, { steamId: steamId.getSteamID64(), data });
1297
1300
 
1301
+ // cleanNodeSteamUserData
1298
1302
  for (const friendSteamId in steamClient.users) {
1299
1303
  steamClient.users[friendSteamId] = {};
1300
1304
  }
1305
+ if (_cleanNodeSteamUserTimeout) {
1306
+ clearTimeout(_cleanNodeSteamUserTimeout);
1307
+ }
1308
+ _cleanNodeSteamUserTimeout = setTimeout(function () {
1309
+ steamClient.users = {};
1310
+ }, 60000);
1301
1311
 
1302
1312
  const dataExample = {
1303
1313
  rich_presence: [
@@ -1435,7 +1445,12 @@ function SteamClient({ username, password, cookie, clientJsToken, isAutoRequestF
1435
1445
  callEvent(events.friendsList, getFriendList());
1436
1446
 
1437
1447
  steamClient.myFriends = {};
1438
- setTimeout(function () {
1448
+
1449
+ if (_cleanNodeSteamFriendTimeout) {
1450
+ clearTimeout(_cleanNodeSteamFriendTimeout);
1451
+ }
1452
+
1453
+ _cleanNodeSteamFriendTimeout = setTimeout(function () {
1439
1454
  steamClient.myFriends = {};
1440
1455
  }, 10000);
1441
1456
  },
@@ -1483,7 +1498,12 @@ function SteamClient({ username, password, cookie, clientJsToken, isAutoRequestF
1483
1498
  },
1484
1499
  async licenses() {
1485
1500
  steamClient.licenses = [];
1486
- setTimeout(function () {
1501
+
1502
+ if (_cleanNodeSteamLicensesTimeout) {
1503
+ clearTimeout(_cleanNodeSteamLicensesTimeout);
1504
+ }
1505
+
1506
+ _cleanNodeSteamLicensesTimeout = setTimeout(function () {
1487
1507
  steamClient.licenses = [];
1488
1508
  }, 10000);
1489
1509
  },
@@ -1788,6 +1808,19 @@ function SteamClient({ username, password, cookie, clientJsToken, isAutoRequestF
1788
1808
  function logOff() {
1789
1809
  isLogOff = true;
1790
1810
  logOffEvent?.(true);
1811
+ if (_cleanNodeSteamUserTimeout) {
1812
+ clearTimeout(_cleanNodeSteamUserTimeout);
1813
+ }
1814
+ if (_cleanNodeSteamLicensesTimeout) {
1815
+ clearTimeout(_cleanNodeSteamLicensesTimeout);
1816
+ }
1817
+ if (_cleanNodeSteamFriendTimeout) {
1818
+ clearTimeout(_cleanNodeSteamFriendTimeout);
1819
+ }
1820
+ steamClient.users = {};
1821
+ steamClient.myFriends = {};
1822
+ steamClient.licenses = [];
1823
+
1791
1824
  steamClient.logOff();
1792
1825
  }
1793
1826
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "steamutils",
3
- "version": "1.4.46",
3
+ "version": "1.4.48",
4
4
  "main": "index.js",
5
5
  "dependencies": {
6
6
  "alpha-common-utils": "^1.0.6",