Jump to content
McKay Development

What Comes Around

  • Posts

  • Joined

  • Last visited

Recent Profile Visitors

465 profile views

What Comes Around's Achievements

  1. Is there a way to get all the items on the steam market for CSGO? I have tried omitting query string and using '' (so nothing), but got back some error. I think it was there are no items with that keyword or something.
  2. Thanks! I appreciate the help Edit: I got everything figured out
  3. Good day, I have been trying to make a function that searches for a random item on the steam market, I ran into an issue. Here is the error: C:\Users\Ernest\Desktop\SteamBot\Current Version\node_modules\steamcommunity\classes\CMarketSearchResult.js:62 callback(new Error($errorMsg.text())); ^ TypeError: callback is not a function at SteamCommunity.<anonymous> (C:\Users\Ernest\Desktop\SteamBot\Current Version\node_modules\steamcommunity\classes\CMarketSearchResult.js:62:5) at Request._callback (C:\Users\Ernest\Desktop\SteamBot\Current Version\node_modules\steamcommunity\components\http.js:67:15) at Request.self.callback (C:\Users\Ernest\Desktop\SteamBot\Current Version\node_modules\request\request.js:185:22) at Request.emit (events.js:315:20) at Request.<anonymous> (C:\Users\Ernest\Desktop\SteamBot\Current Version\node_modules\request\request.js:1154:10) at Request.emit (events.js:315:20) at Gunzip.<anonymous> (C:\Users\Ernest\Desktop\SteamBot\Current Version\node_modules\request\request.js:1076:12) at Object.onceWrapper (events.js:421:28) at Gunzip.emit (events.js:315:20) at endReadableNT (internal/streams/readable.js:1327:12) C:\Users\Ernest\Desktop\SteamBot\Current Version>pause Press any key to continue . . . Looking at the code here is what I see: function performSearch() { self.httpRequest({ "uri": "https://steamcommunity.com/market/search/render/", "qs": qs, "headers": { "referer": "https://steamcommunity.com/market/search" }, "json": true }, function(err, response, body) { if (err) { callback(err); return; } if(!body.success) { callback(new Error("Success is not true")); return; } if(!body.results_html) { callback(new Error("No results_html in response")); return; } var $ = Cheerio.load(body.results_html); var $errorMsg = $('.market_listing_table_message'); if($errorMsg.length > 0) { callback(new Error($errorMsg.text())); return; } var rows = $('.market_listing_row_link'); for(var i = 0; i < rows.length; i++) { results.push(new CMarketSearchResult($(rows))); } if(body.start + body.pagesize >= body.total_count) { callback(null, results); } else { qs.start += body.pagesize; performSearch(); } }, "steamcommunity"); } }; Here is my code: community.marketSearch(query, 730, false, function(err, items) { if (err) { console.log(err) } else { console.log(items) resolve(items); } }) }) I don't think there is anything wrong with my code, any ideas?
  4. Good news, well I mean the error still occurs but I know what's going on. And knowing is good . As you can see, while the error did look scary being displayed 5-10 times, all accounts do get successful requests from time to time. In fact, more often than not. So the fear factor was just a result of the scale I'm working in. I am not sure why this is the error I get instead of 502, but whatever, it's not catastrophic. Problem solved.
  5. I have looked at several ways I thought I could prevent this error, but I am still getting it. I cannot understand why it is happening. I have even made the client weblog() when the error occurs more than 10 times in succession. Still doesn't fix it. Do you know what this error could be? Because I cannot understand what the cause is.
  6. Oh I see, what happens in that case? Is there a similar property I could use for steamcommunity?
  7. Yes, I have a listener for the event and I check the steamID property. So the sessionExpired event gets handled, I don't understand why I am getting the error in that case. Here is my listener: community.on('sessionExpired', () => { information.steam_webservice_connection = 'disconnected'; log.info('LoginClient', `${user.username}'s websession expired!`) if (client.steamID == null) { log.info('LoginClient', `${user.username} was disconnected from steam! Relogging in.`) } else { client.webLogOn(); } }) So in this way if the websession is expired I log in again, otherwise it does nothing because I have relogging in enabled as default. Also I have a bit of code that checks the steam community steamID and steam client steamID to check if the user is connected: if (SteamClients[user].client.steamID == null || SteamClients[user].community.steamID == null) { connection = '\x1b[31mdisconnected\x1b[37m' } else { connection = '\x1b[32mconnected\x1b[37m' } and so far it seems the clients and webclients are always connected, unless steam is down. And keep in mind, as I am seeing all accounts connected, I am getting this error. So I thought it must be a cookies issue, that's why manager doesn't have access to the inventory, but then I have this listener: client.on('webSession', (sid, cookies) => { information.steam_webservice_connection = 'connected'; manager.setCookies(cookies); community.setCookies(cookies); hasWebSession = true; log.debug('LoginClient', `Client weblogged in ${user.username}`) if(isLoggedOn) { stratup = true; information.start_time = Date.now(); resolve() }; }) So if the client makes a new session (and it negotiates a websession) this event should fire. And if a new websession is established from the session expiration listener, this should fire. So, in any case manager's cookies should be up to date. So I really don't understand why I am getting this error. One more thing I should probably mention is these are my options for the manager constructor: manager: new TradeOfferManager({ steam: this.client, community: this.community, language: 'en' }) Would this perhaps need to be updated if a new client session/websession is established? I don't see why it should as the client and community constructors don't change, their sessions do but not the constructor themselves. But I just thought I should throw this out there.
  8. Good day! Recently I was surprised to find that my bots had inventories but looking at the logs they said they didn't have anything. So after enabling output settings I got to see the error. I am getting this error: Of course the Error in getting inventory part is my own. Here is my code for getting the inventory: function GetInventory(user){ return new Promise((resolve, reject) => { const { client, community, manager, details: { username, password, shared_secret, }, } = SteamClients[user.username]; manager.getInventoryContents(730, 2, false, (err, inventory) => { if (err) { log.debug('GetInventory', err) reject(err); } else { resolve(inventory); } }) }) } I am confused as to why this happens after some time of my bots running. I considered that maybe when the sessions expire the cookies for manager don't get reassigned, but they do. I webRelog when the websession expires, I have relog enabled (as default) and I have all the appropriate event listeners and manager's cookies are set on a new websession being established. So I don't understand why this is happening. Any ideas?
  9. Also, are the events 'loggedOn' and 'disconnected' directly tied to the state of client.steamID? Also, is client.steamID an accurate indicator of the client being connected? If I had to guess, client.steamID is returned by steam and is nullified when the connection is broken, and when the ID is returned (Client is connected) or there is a disconnection those events are emitted. Is my assumption correct?
  10. That's strange. Because based on my code I don't see how this should occur. Below I will include the only code that should relogin the user. community.on('sessionExpired', () => { log.info('LoginClient', `${user.username}'s websession expired!`) if (client.steamID == null) { log.info('LoginClient', `${user.username} was disconnected from steam! Relogging in.`) client.logOn({ accountName: username, password: password, rememberPassword: true, twoFactorCode: SteamTotp.generateAuthCode(shared_secret), }); } else { client.webLogOn(); } }) Let me know if you see anything wrong with this. Because unless client.steamID doesn't always return the correct login status, I don't see why this error should occur. Also, I should mention that before the code above was introduced, I wasn't getting the "already logged in" error. Edit: Thinking about it now, perhaps the issue is that when I log in via client.logOn I replace the session, and because I have relog turned on, it relogs in, causing this loop. Because I am getting 1000s of relogins and the Replaced Session error pops up as well. So if I had to guess that's the cause, and the fix would be to just not call logOn, let it do it's thing but once client.steamID is ! null,call client.webLogOn(). Anyways, that's just me guessing. I'd like to hear your thoughts on what's happening.
  11. I get this error from time to time: (node:31740) UnhandledPromiseRejectionWarning: Error: Already logged on, cannot log on again at C:\Users\Ernest\Desktop\Current Version\node_modules\steam-user\components\logon.js:23:10 at processTicksAndRejections (internal/process/task_queues.js:75:11) (node:31740) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 3) Sometimes my bot experiences this error maybe times in a row. Worst case scenario I've seen it reoccur 100 times. Any idea what could be the cause of this issue? I found this while looking at the steam user npm: https://www.npmjs.com/package/steam-user#events-. At steamGuard I can see that you mention: "If you are using 2FA, you need to check the lastCodeWrong argument. If it's true, then the last code you provided was incorrect (likely already used). In this case, you should wait 30 seconds to allow the TOTP algorithm to generate a new code. Failure to do so will result in a login loop, causing your IP address to be temporarily banned.". Could this be the cause of the error?
  12. Perfect! Thank you! Also if I use the logOn() function, by default the webLogOn function is called too, right?
  13. C:\Users\Ernest\Desktop\SteamBot\node_modules\steam-user\components\web.js:10 throw new Error("Cannot log onto steamcommunity.com without first being connected to Steam network"); ^ Error: Cannot log onto steamcommunity.com without first being connected to Steam network at SteamUser.webLogOn (C:\Users\Ernest\Desktop\SteamBot\node_modules\steam-user\components\web.js:10:9) at SteamCommunity.<anonymous> (C:\Users\Ernest\Desktop\SteamBot\components\steamclient.js:73:20) at SteamCommunity.emit (events.js:315:20) at SteamCommunity._notifySessionExpired (C:\Users\Ernest\Desktop\SteamBot\node_modules\steamcommunity\components\http.js:85:7) at C:\Users\Ernest\Desktop\SteamBot\node_modules\steamcommunity\components\confirmations.js:21:10 at C:\Users\Ernest\Desktop\SteamBot\node_modules\steamcommunity\components\confirmations.js:272:4 at SteamCommunity._checkHttpError (C:\Users\Ernest\Desktop\SteamBot\node_modules\steamcommunity\components\http.js:90:3) at Request._callback (C:\Users\Ernest\Desktop\SteamBot\node_modules\steamcommunity\components\http.js:50:61) at self.callback (C:\Users\Ernest\Desktop\SteamBot\node_modules\request\request.js:185:22) at Request.emit (events.js:315:20) Function that triggers it: client.logOn({ accountName: username, password: password, rememberPassword: true, twoFactorCode: SteamTotp.generateAuthCode(shared_secret), }); client.on('loggedOn', ()=> { isLoggedOn = true; client.setPersona(1); log.debug('LoginClient', `Client logged in ${user.username}`) if(hasWebSession) resolve(); }) client.on('webSession', (sid, cookies) => { manager.setCookies(cookies); community.setCookies(cookies); hasWebSession = true; log.debug('LoginClient', `Client weblogged in ${user.username}`) if(isLoggedOn) resolve(); }) client.on('error', (err) => { log.error('LoginClient', `Client experienced an error ${user.username}`) log.error('LoginClient', err) }) community.on('sessionExpired', () => { log.info('LoginClient', `${user.username}'s websession expired!`) client.webLogOn(); }) community.on('sessionExpired', () => { log.info('LoginClient', `${user.username}'s websession expired!`) client.webLogOn(); }) Here is an error I am getting when checking for an expired session. Would it be possible to prevent this? I mean I think I could do something along the lines of try catching weblogOn, but do you perhaps have a better solution?
  • Create New...