steamutils 1.3.42 → 1.3.43
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 +20 -8
- package/package.json +1 -1
    
        package/SteamClient.js
    CHANGED
    
    | @@ -97,7 +97,8 @@ function SteamClient({ | |
| 97 97 | 
             
                                     isInvisible = false,
         | 
| 98 98 | 
             
                                     autoAcceptTradeRequest = false,
         | 
| 99 99 | 
             
                                     autoReconnect = true,
         | 
| 100 | 
            -
                                     MAX_GAME_PLAY = 10
         | 
| 100 | 
            +
                                     MAX_GAME_PLAY = 10,
         | 
| 101 | 
            +
                                     games = null
         | 
| 101 102 | 
             
                                 }) {
         | 
| 102 103 | 
             
                const steamClient = new NodeSteamUser()
         | 
| 103 104 | 
             
                let prime = null
         | 
| @@ -367,6 +368,10 @@ function SteamClient({ | |
| 367 368 | 
             
                }
         | 
| 368 369 |  | 
| 369 370 | 
             
                async function gamePlay() {
         | 
| 371 | 
            +
                    if ((Array.isArray(games) && games.length) || (games && (typeof games === "number" || typeof games === "string"))) {
         | 
| 372 | 
            +
                        return gamesPlayed(games)
         | 
| 373 | 
            +
                    }
         | 
| 374 | 
            +
             | 
| 370 375 | 
             
                    let ownedApps = []
         | 
| 371 376 | 
             
                    for (let i = 0; i < 5; i++) {
         | 
| 372 377 | 
             
                        ownedApps = await getUserOwnedApps()
         | 
| @@ -591,7 +596,7 @@ function SteamClient({ | |
| 591 596 | 
             
                        return
         | 
| 592 597 | 
             
                    }
         | 
| 593 598 |  | 
| 594 | 
            -
                    if(!Array.isArray(steamIds)){
         | 
| 599 | 
            +
                    if (!Array.isArray(steamIds)) {
         | 
| 595 600 | 
             
                        steamIds = [steamIds]
         | 
| 596 601 | 
             
                    }
         | 
| 597 602 |  | 
| @@ -605,7 +610,7 @@ function SteamClient({ | |
| 605 610 |  | 
| 606 611 | 
             
                    for (const steamId of steamIds) {
         | 
| 607 612 | 
             
                        onInvite?.(lobbyID, steamId)
         | 
| 608 | 
            -
             | 
| 613 | 
            +
                        await invite2Lobby(lobbyID, steamId)
         | 
| 609 614 | 
             
                    }
         | 
| 610 615 |  | 
| 611 616 | 
             
                    return lobbyID
         | 
| @@ -784,7 +789,7 @@ function SteamClient({ | |
| 784 789 | 
             
                                    errorStr = `Unknown: ${e.eresult}`
         | 
| 785 790 | 
             
                                    break
         | 
| 786 791 | 
             
                            }
         | 
| 787 | 
            -
                            log( | 
| 792 | 
            +
                            log(`error [isLogOff: ${isLogOff}]`, e?.message)
         | 
| 788 793 | 
             
                            doClearIntervals()
         | 
| 789 794 | 
             
                            callEvent(events.error, {eresult: e.eresult, msg: e.message, error: errorStr})
         | 
| 790 795 | 
             
                        },
         | 
| @@ -1954,9 +1959,15 @@ function SteamClient({ | |
| 1954 1959 | 
             
                    }
         | 
| 1955 1960 |  | 
| 1956 1961 | 
             
                    steamClient.gamesPlayed(apps);
         | 
| 1957 | 
            -
                     | 
| 1958 | 
            -
                     | 
| 1959 | 
            -
                     | 
| 1962 | 
            +
                    const shouldHello = apps.some(app => parseInt(app) === 730);
         | 
| 1963 | 
            +
                    await sleep(1000)
         | 
| 1964 | 
            +
                    if (shouldHello) {
         | 
| 1965 | 
            +
                        await sendHello()
         | 
| 1966 | 
            +
                    }
         | 
| 1967 | 
            +
                    await sleep(1000)
         | 
| 1968 | 
            +
                    if (shouldHello) {
         | 
| 1969 | 
            +
                        await sendHello()
         | 
| 1970 | 
            +
                    }
         | 
| 1960 1971 | 
             
                    updateFakeGameScore()
         | 
| 1961 1972 |  | 
| 1962 1973 | 
             
                    // await sleep(10000)
         | 
| @@ -2256,7 +2267,7 @@ function SteamClient({ | |
| 2256 2267 | 
             
                    },
         | 
| 2257 2268 | 
             
                    getUserOwnedApps,
         | 
| 2258 2269 | 
             
                    getPlayingAppIds,
         | 
| 2259 | 
            -
                    getCurrentLobby(){
         | 
| 2270 | 
            +
                    getCurrentLobby() {
         | 
| 2260 2271 | 
             
                        return currentLobby
         | 
| 2261 2272 | 
             
                    }
         | 
| 2262 2273 | 
             
                }
         | 
| @@ -2281,6 +2292,7 @@ SteamClient.isAccountPlayable = function isAccountPlayable(cookie, timeoutMs) { | |
| 2281 2292 | 
             
                        isPartyRegister: false,
         | 
| 2282 2293 | 
             
                        isInvisible: false,
         | 
| 2283 2294 | 
             
                        MAX_GAME_PLAY: 10,
         | 
| 2295 | 
            +
                        games: 730,
         | 
| 2284 2296 | 
             
                    });
         | 
| 2285 2297 |  | 
| 2286 2298 | 
             
                    steamClient.onEvent("error", ({eresult, msg, error}) => {
         |