Jump to content
McKay Development

ktfo

Member
  • Posts

    9
  • Joined

  • Last visited

ktfo's Achievements

  1. It was implemented to Steam relatively recently. Is this something to expect in a future release, or did I completely overlook something? Thanks.
  2. I am looking to have an account accept certain incoming trades (donations), and handle them accordingly. My question is: how do I best keep track of trades/items currently held by Steam due to the sender not having a mobile authenticator? I want to act only when the trade goes through and my account receives the item(s). Do I keep track of when the trade is supposed to go through after 14 days and use getOffer() some time after that? Thanks.
  3. That's a shame. I'm seeing \white\1 Servers that are whitelisted is in the filters list - what is this exactly? Can you add server addresses to a local whitelist and search for them only? I've looked around and can't find any documentation whatsoever. In the Steam client there's a "favorite" tab where you can query favorited servers only, is there any way you can simulate that (local whitelist, set of addresses) using Node in any way? Thanks.
  4. I am looking to get information such as current map, amount of players, etc. from multiple specified IP addresses - how would one go about doing this in the best way? I found it can be achieved through this API call: https://api.steampowered.com/IGameServersService/GetServerList/v1/?key=xxx&limit=5&filter=\gameaddr\x.x.x.x I want to check upwards of 50-100 servers every 10-20 seconds - is this possible? Thanks.
  5. That did the trick, thank you. On another somewhat related note - am I doing something wrong, or is it simply not possible to not have to enter the Steam Guard Code a second time for a new session after being kicked with kickPlayingSession? I'm looking to have the script handle the 'error' and resume idling after the user kicked the session by launching a game. I figured relog() would do, but it does nothing. Archie Steam Farm does this, so I guess it should be possible somehow? Code: const SteamClient = require('steam-user'); const client = new SteamClient({"enablePicsCache": true, "protocol": SteamClient.EConnectionProtocol.TCP}); const logInOptions = { accountName: '', password: '', rememberPassword: true }; client.logOn(logInOptions); client.on('appOwnershipCached', function () { client.gamesPlayed([9400]); }); client.on('loggedOn', function () { console.log('Logged on Steam.'); client.setPersona(SteamClient.EPersonaState.Online); }) client.on('loginKey', function (key) { console.log('Got login key ' + key); }) client.on("error", error => { console.log("An error has occurred: " + error.message); if (error.message == 'LoggedInElsewhere') { console.log('Logging back in.') client.relog(); } } ); Log: [debug] Sending message: 5410 [debug] Handled message: 9600 [debug] Handled message: 779 [debug] Received 1 game connect tokens [debug] Unhandled message: PlayerClient.NotifyLastPlayedTimes#1 [debug] Handled message: 766 [debug] Sending message: 8903 [debug] Handled message: 8904 [debug] Handled message: 766 [debug] Handled message: 822 [debug] Handled message: 766 [debug] Handled message: 766 [debug] Handled message: 766 [debug] Handled message: 822 [debug] Handled message: 766 [debug] Handled message: 822 [debug] Handled message: 822 [debug] Handled message: 766 [debug] Handled message: 766 [debug] Handled message: 766 [debug] Handled message: 766 [debug] Handled message: 822 [debug] Handled message: 822 [debug] Handled message: 766 [debug] Handled message: 757 [debug] Logged off: LoggedInElsewhere An error has occurred: LoggedInElsewhere Logging back in. [debug] Sending message: 706 Logging off, then back in with the login key after a few seconds delay seems to work? I'll post a refined version of the script when I'm done, if anyone is interested.
  6. Thanks for taking the time to look into the issue. I've been trying to find the cause for the issue for the past two days, and have come to the conclusion that it's simply the account in question. As you can see in the original post, it has over 20K apps, causing sporadic timeouts after logging in, for some reason. The piece of code below yielded this result: ... [debug] Handled message: 766 [debug] Handled message: 766 [debug] Handled message: 766 [debug] Handled message: 766 [debug] Handled message: 766 [debug] Handled message: 766 [debug] Handled message: 766 [debug] Handled message: 766 [debug] Handled message: 766 [debug] Handled message: 766 [debug] API POST request to https://api.steampowered.com/ISteamUserAuth/Authenti cateUser/v0001/: 200 [debug] Sending message: 8901 [debug] WebSocket disconnected with error: Ping timeout [debug] Using WebSocket; we rolled 26 and percent to use WS is 50 [debug] WebSocket connection success; now logging in [debug] Sending message: 5514 [debug] Handled message: 751 Steam Guard App Code: Code: const SteamClient = require('steam-user'); const client = new SteamClient({"enablePicsCache": true}); const logInOptions = { accountName: '', password: '' }; client.logOn(logInOptions); client.on('appOwnershipCached', function () { console.log('Loaded.'); }); client.on('debug', (msg) => console.log('[debug] ' + msg)); Do you have any idea what might be causing this? Is there anything that can be done about it?
  7. I now noticed it happens every time I run the script after first running it 1-2 times (passing an array of 29 appIDs to gamesPlayed each time). Am I passing too many appIDs to gamesPlayed in a short time span?Am I exiting the process wrongly? Should I pass an emtpy array to gamesPlayed first?
  8. Oh, right. Here's the log: [debug] Handled message: 766 [debug] Handled message: 766 [debug] Handled message: 766 [debug] Handled message: 766 [debug] Handled message: 766 [debug] Handled message: 766 [debug] Handled message: 766 [debug] Handled message: 766 [debug] Handled message: 766 [debug] Handled message: 766 [debug] Handled message: 766 [debug] Handled message: 766 [debug] Handled message: 766 [debug] Handled message: 766 [debug] API POST request to https://api.steampowered.com/ISteamUserAuth/AuthenticateUser/v0001/: 200 Got web session Idle all Steam games Amount of games: 20707 Games left to idle: 18065 [debug] Sending message: 5410 Now idling: 29 Eets [2.95] Jade Empire: Special Edition [2.62] Peggle Deluxe [0.95] Making History: The Calm & The Storm [0.95] Silverfall [0.95] FlatOut 2 [0.95] Just Cause [0.93] Space Empires IV Deluxe [0.93] Space Empires V [0.93] Vampire: The Masquerade - Bloodlines [0.93] Joint Task Force [0.02] Rogue Trooper [0.02] Arx Fatalis [0.02] Tomb Raider: Anniversary [0.02] Sam & Max 101: Culture Shock [0.02] Sam & Max 102: Situation: Comedy [0.02] Sam & Max 103: The Mole, the Mob and the Meatball [0.02] Sam & Max 105: Reality 2.0 [0.02] Sam & Max 106: Bright Side of the Moon [0.02] Geometry Wars: Retro Evolved [0.02] Lost Planet: Extreme Condition [0.02] Venice [0.02] Nexus: The Jupiter Incident [0.02] ThreadSpace: Hyperbol [0.02] Full Spectrum Warrior [0.02] Full Spectrum Warrior: Ten Hammers [0.02] Commander Keen Complete Pack [0.02] Wolfenstein 3D [0.02] Wolfenstein 3D: Spear of Destiny [0.02] Last update: 15:29:38 [debug] WebSocket disconnected with error: Ping timeout [debug] Using TCP; we rolled 56 and percent to use WS is 50 [debug] Connecting to TCP CM: 146.66.152.10:27018 [debug] TCP connection established [debug] Handled message: 1303 [debug] Channel encrypt request: protocol 1, universe 1, nonce xxxx, 0 remaining bytes [debug] Sending message: 1304 [debug] Handled message: 1305 [debug] Sending message: 5514 [debug] Handled message: 751 Steam Guard App Code: I suppose I'm being timed out, but why?
  9. I wrote an application that idles all of my games to x amount of minutes. My problem is that after logging in and passing some appIds to gamesPlayed, I am being prompted to enter my Steam Guard code after a while. I have had it run fine for over 30 minutes sometimes before being asked, but it's usually within 5-10 minutes. I'm listening to both sessionExpired and error, but it doesn't seem to be either of them. The goal is to log on just once and have it idle games until the application is closed. I call webLogOn every 15 minutes, but that doesn't seem to be the problem, as I'm usually prompted before that. I've also tried assigning the loginKey to my log in options after first logging in, which supposedly omits the need for a guard code, but that doesn't work either. Why is this happening? Any help would be greatly appreciated. Code: global._mckay_statistics_opt_out = true; const SteamClient = require('steam-user'); const SteamCommunity = require('steamcommunity'); const community = new SteamCommunity(); const client = new SteamClient(); let apiKey = (''); const minutesToIdle = 180; let gamesToIdle = []; let gamesTimePlayed = []; let appNames; let steamID; const logInOptions = { accountName: '', password: '', logonID: Date.now(), rememberPassword: true }; // Initialize (function () { console.log('Loading game names...') community.request('some api', (error, response, data) => { if (!error && response.statusCode == 200) { appNames = JSON.parse(data).data; client.logOn(logInOptions); } else { console.log('Failed to get game names, listing AppIDs instead.') setTimeout(function() { client.logOn(logInOptions); }, 4000); } }) })() client.on("webSession", (sessionID, cookies) => { console.clear(); console.log("Got web session"); community.setCookies(cookies); getGamesInfo(); }); // Get owned games and time information. function getGamesInfo () { gamesToIdle.length = 0; gamesTimePlayed.length = 0; console.log('\x1b[36m%s\x1b[0m', 'Idle all Steam games'); community.request('https://api.steampowered.com/IPlayerService/GetOwnedGames/v0001/?key=' + apiKey + '&steamid=' + steamID, (error, response, data) => { if (!error && response.statusCode == 200) { const gamesData = JSON.parse(data); const gamesTotal = gamesData.response.game_count; console.log('\x1b[32m%s\x1b[0m', '\nAmount of games: ' + gamesTotal); // Check playtime for past 2 weeks and forever. for (var i = 0; i < gamesTotal; i++) { if (gamesData.response.games[i].playtime_forever < minutesToIdle) { if (gamesData.response.games[i].playtime_2weeks == null || gamesData.response.games[i].playtime_2weeks < minutesToIdle) { gamesToIdle.push(gamesData.response.games[i].appid); gamesTimePlayed.push(getMostTime(gamesData.response.games[i].playtime_forever, gamesData.response.games[i].playtime_2weeks)); } } } if (gamesToIdle.length > 1 ) { console.log('\x1b[32m%s\x1b[0m', 'Games left to idle: ' + gamesToIdle.length); assignAppNames(); } else { console.log('Done idling.') } } else { console.log('Error loading games, retrying in 1 minute...'); setTimeout(function() { client.webLogOn(); }, 600000); } }) } // Returns most time played between last 2 weeks and forever. function getMostTime (a, { if (a > { return a; } else { return b; } } // Assigns app names to display, or appIDs if none found. function assignAppNames () { let gameNames = []; for (var i = 0; i < 29 && i < gamesToIdle.length; i++) { if (appNames != null && appNames.hasOwnProperty(gamesToIdle[i])) { gameNames.push(appNames[gamesToIdle[i]]); } else { gameNames.push(gamesToIdle[i]); } } idleGames(gameNames); } // Idle the games. function idleGames (gameNames) { let idleNow = []; for (var i = 0; i < 29 && idleNow.length < gamesToIdle.length; i++) { idleNow.push(gamesToIdle[i]); } client.gamesPlayed(idleNow); console.log('\x1b[32m%s\x1b[0m', 'Now idling: ' + idleNow.length + '\n') gameNames.forEach(function(element) { console.log(element + '\x1b[33m%s\x1b[0m', ' [' + (gamesTimePlayed[gameNames.indexOf(element)] / 60).toFixed(2) + ']'); }) console.log('\n' + 'Last update: ' + '\x1b[33m%s\x1b[0m', getDateTime()); setTimeout(function() { client.webLogOn(); }, 900000); } community.on("sessionExpired", error => { console.log("Steam web session expired: " + error.message); if (client.steamID) { client.webLogOn(); } else { client.logInOptions.logonID = Date.now(); client.logOn(logInOptions); } }); client.on("error", error => { console.log("An error has occurred: " + error.message); } ); client.on('loggedOn', (details) => { console.log('Logged on Steam.'); client.setPersona(SteamClient.EPersonaState.Invisible); steamID = details.client_supplied_steamid; }); function getDateTime() { var date = new Date(); var hour = date.getHours(); hour = (hour < 10 ? "0" : "") + hour; var min = date.getMinutes(); min = (min < 10 ? "0" : "") + min; var sec = date.getSeconds(); sec = (sec < 10 ? "0" : "") + sec; var year = date.getFullYear(); var month = date.getMonth() + 1; month = (month < 10 ? "0" : "") + month; var day = date.getDate(); day = (day < 10 ? "0" : "") + day; return hour + ":" + min + ":" + sec; }
×
×
  • Create New...