steamutils 1.0.73 → 1.0.75

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 +30 -2
  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
  }
@@ -262,6 +277,16 @@ function SteamClient({
262
277
  steamClient.gamesPlayed([...ownedApps, 730])
263
278
  }
264
279
 
280
+ async function autoGamePlay() {
281
+ await gamePlay()
282
+ doSetInterval(gamePlay, [15 * 60000, 30 * 60000], 'autoGamePlay')
283
+ }
284
+
285
+ async function offAutoGamePlay() {
286
+ steamClient.gamesPlayed([])
287
+ doClearInterval('autoGamePlay')
288
+ }
289
+
265
290
 
266
291
  /**
267
292
  * Get a list of lobbies (* = Unsure description could be wrong)
@@ -664,8 +689,7 @@ function SteamClient({
664
689
  }
665
690
 
666
691
  if (autoPlay) {
667
- gamePlay()
668
- doSetInterval(gamePlay, [15 * 60000, 30 * 60000], 'gamePlay')
692
+ autoGamePlay()
669
693
  }
670
694
  })
671
695
 
@@ -1099,6 +1123,10 @@ function SteamClient({
1099
1123
  gamesPlayed,
1100
1124
  sendHello,
1101
1125
  checkPlayerPrimeStatus,
1126
+ doClearInterval,
1127
+ gamePlay,
1128
+ autoGamePlay,
1129
+ offAutoGamePlay,
1102
1130
  }
1103
1131
  }
1104
1132
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "steamutils",
3
- "version": "1.0.73",
3
+ "version": "1.0.75",
4
4
  "dependencies": {
5
5
  "axios": "^1.3.4",
6
6
  "cheerio": "^1.0.0-rc.12",