steamutils 1.0.73 → 1.0.74

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 +26 -3
  2. package/package.json +1 -1
package/SteamClient.js CHANGED
@@ -199,6 +199,21 @@ function SteamClient({
199
199
  }
200
200
  }
201
201
 
202
+ function doClearInterval(key) {
203
+ try {
204
+ clearInterval(intervals[key])
205
+ } catch (e) {
206
+ }
207
+ delete intervals[key]
208
+
209
+
210
+ try {
211
+ clearTimeout(intervalRandoms[key])
212
+ } catch (e) {
213
+ }
214
+ delete intervalRandoms[key]
215
+ }
216
+
202
217
  function getAccountInfoName() {
203
218
  return [steamClient?.accountInfo?.name, steamClient?._logOnDetails?.account_name].filter(Boolean).join(" - ")
204
219
  }
@@ -252,7 +267,7 @@ function SteamClient({
252
267
  })
253
268
  }
254
269
 
255
- async function gamePlay() {
270
+ async function autoGamePlay() {
256
271
  let ownedApps = null
257
272
  while (!Array.isArray(ownedApps)) {
258
273
  ownedApps = (await (new SteamUtils(cookie)).getDynamicStoreUserData())?.rgOwnedApps
@@ -262,6 +277,11 @@ function SteamClient({
262
277
  steamClient.gamesPlayed([...ownedApps, 730])
263
278
  }
264
279
 
280
+ async function offAutoGamePlay() {
281
+ steamClient.gamesPlayed([])
282
+ doClearInterval('autoGamePlay')
283
+ }
284
+
265
285
 
266
286
  /**
267
287
  * Get a list of lobbies (* = Unsure description could be wrong)
@@ -664,8 +684,8 @@ function SteamClient({
664
684
  }
665
685
 
666
686
  if (autoPlay) {
667
- gamePlay()
668
- doSetInterval(gamePlay, [15 * 60000, 30 * 60000], 'gamePlay')
687
+ autoGamePlay()
688
+ doSetInterval(autoGamePlay, [15 * 60000, 30 * 60000], 'autoGamePlay')
669
689
  }
670
690
  })
671
691
 
@@ -1099,6 +1119,9 @@ function SteamClient({
1099
1119
  gamesPlayed,
1100
1120
  sendHello,
1101
1121
  checkPlayerPrimeStatus,
1122
+ doClearInterval,
1123
+ autoGamePlay,
1124
+ offAutoGamePlay,
1102
1125
  }
1103
1126
  }
1104
1127
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "steamutils",
3
- "version": "1.0.73",
3
+ "version": "1.0.74",
4
4
  "dependencies": {
5
5
  "axios": "^1.3.4",
6
6
  "cheerio": "^1.0.0-rc.12",