steamutils 1.3.39 → 1.3.40

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.
package/SteamClient.js CHANGED
@@ -586,7 +586,7 @@ function SteamClient({
586
586
  // })
587
587
  }
588
588
 
589
- async function createThenInvite2Lobby(steamIds) {
589
+ async function createThenInvite2Lobby(steamIds, onInvite) {
590
590
  if (!steamClient.steamID) {
591
591
  return
592
592
  }
@@ -604,8 +604,11 @@ function SteamClient({
604
604
  }
605
605
 
606
606
  for (const steamId of steamIds) {
607
+ onInvite?.(lobbyID, steamId)
607
608
  await invite2Lobby(lobbyID, steamId)
608
609
  }
610
+
611
+ return lobbyID
609
612
  }
610
613
 
611
614
 
@@ -0,0 +1,55 @@
1
+ import SteamUser from "./index.js";
2
+
3
+ (async function () {
4
+ let json = ``
5
+ for (const methodName of Object.getOwnPropertyNames(SteamUser.prototype)) {
6
+ if (methodName === "constructor") {
7
+ continue
8
+ }
9
+ const fnString = SteamUser.prototype[methodName].toString().trim()
10
+ const async = "async";
11
+ // const async = fnString.startsWith("async") ? "async" : "";
12
+ let params = fnString.split('(')[1].split(')')[0];
13
+ const paramsList = params.split(',')
14
+ for (let i = 0; i < paramsList.length; i++) {
15
+ if (paramsList[i].includes("=")) {
16
+ paramsList[i] = paramsList[i].split("=")[0].trim()
17
+ }
18
+ }
19
+ params = paramsList.join(', ').trim()
20
+ if(params.startsWith("{") && !params.endsWith("}")){
21
+ params = params + "}"
22
+ }
23
+
24
+ json += `
25
+ ${async} ${methodName}(${params}){
26
+ if(!RemoteSteamUser.__appIndex){
27
+ RemoteSteamUser.__appIndex = 0
28
+ }
29
+ RemoteSteamUser.__appIndex++
30
+ if(RemoteSteamUser.__appIndex >= RemoteSteamUser.__apps.length){
31
+ RemoteSteamUser.__appIndex = 0
32
+ }
33
+
34
+ const __params = [${params}];
35
+ if(__params.length === 1 && __params[0] === undefined){
36
+ __params.length = 0
37
+ }
38
+
39
+ try {
40
+ const result = (
41
+ await axios.post(RemoteSteamUser.__apps[RemoteSteamUser.__appIndex], {
42
+ method: "${methodName}",
43
+ params: __params,
44
+ cookies: this._cookies,
45
+ })
46
+ ).data?.result;
47
+ return result
48
+ } catch (e) {
49
+ }
50
+ }`.trim() + '\n'
51
+ }
52
+
53
+ console.log('')
54
+
55
+ })()
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "steamutils",
3
- "version": "1.3.39",
3
+ "version": "1.3.40",
4
4
  "main": "index.js",
5
5
  "dependencies": {
6
6
  "alpha-common-utils": "^1.0.5",