Jump to content
McKay Development

RafGDev

Member
  • Posts

    3
  • Joined

  • Last visited

Everything posted by RafGDev

  1. Does this event only get called when an http request fails? So for example is there a timer to check every hour or so if the session is expired or does it only get called when an http request returns status 403. Thanks.
  2. Hey, I am wondering what the best way to detect for invalid cookies is. Detecting Invalid cookies: In the past I have been using node-steam-tradeoffers so if I sent a tradeoffer that returned status 403, I would get new cookies and then resend the tradeoffer. This is the code that I have at the moment: client.logOn(logOnOptions); client.on("webSession", (sessionID, cookies) => { manager.setCookies(cookies, (err) => { if (err) { console.log(err); } }); What is the best way to detect and replace invalid cookies? Thanks
  3. Hey all!, I have pasted my whole script below but please only pay attention to the confirmMobile(userSteamId, callback) function because it is the function that isn't working for me. My main problem (as the title suggests) is that the getConfirmations method only picks up trade offers that I have sent through steamcommunity. Any trade offers that I send through node do not come up. If there is anything that I did wrong please tell me as I have no idea what is wrong with the confirmMobile(userSteamId, callback) function. Any help is greatly appreciated!! var SteamTradeOffers = require('steam-tradeoffers'); var SteamCommunity = require('steamcommunity'); var SteamTotp = require('steam-totp'); var offers = new SteamTradeOffers(); var community = new SteamCommunity(); function confirmMobile(userSteamId, callback) { //This function is called after the trade offer is sent, please look at this function var unixTime = SteamTotp.time(); var confirmationKey = SteamTotp.getConfirmationKey("IDENTITYSECRET", unixTime, "conf"); community.getConfirmations(unixTime, confirmationKey, (err, confirmations) => { if (err) { callback(err); } else { console.log(confirmations); callback(null); } }); } function runBot(userSteamId, skinArray, callback) { // This function makes a trade offer, console.log(typeof userSteamId); if (!userSteamId || !skinArray) { callback(new Error("500error")); } else if (skinArray.length === 0) { callback(new Error("500error")) } else { var sendSkinArray = []; console.log("Skin array 8is: " + skinArray); for (var i = 0;i<skinArray.length;i++) { sendSkinArray.push({ appid: 730, contextid: 2, amount: 1, assetid: String(skinArray[i]) }); if (i === (skinArray.length -1)) { offers.makeOffer({ partnerSteamId: userSteamId, itemsFromMe: sendSkinArray, itemsFromThem: [], message: "Hey! This is the CSGO ACORN bot" },(err, response) => { if (err) { //If cookies have expired, then get new cookies from steamcommunity.com community.login({ "accountName":"USERNAME", "password":"PASSWORD", "twoFactorCode": SteamTotp.generateAuthCode("SHAREDSECRET") },(loginError, sessionID, cookies, steamguard) => { if (loginError) { console.log("err when trying to log inHELLOWO"); callback(new Error("500error")); } else { community.loggedIn((communityError, loggedIn) => { if (communityError) { console.log("err2 was: " + communityError); callback(new Error("loginFailed")); } else { if (loggedIn) { offers.setup({ sessionID:sessionID, webCookie:cookies, APIKey: "SHAREDSECRET", }); runBot(userSteamId, skinArray, callback); } else { callback(new Error("loginFailed")) } } }); } }); } else { console.log(response); confirmMobile(userSteamId, (err, data) => { if (err) { callback(err); } else { callback(null); } }); } }); } } } } community.login({ "accountName":"USERNAME", "password":"PASSWORD", "twoFactorCode": SteamTotp.generateAuthCode("SHAREDSECRET") },(loginError, sessionID, cookies, steamguard) => { if (loginError) { console.log(loginError); } else { community.loggedIn((communityError, loggedIn) => { if (communityError) { console.log("err2 was: " + communityError); } else { if (loggedIn) { offers.setup({ sessionID:sessionID, webCookie:cookies, APIKey: "APIKEY", }); runBot("USERSTEAMID", ["SKINASSETID"], (err) => { if (err) { console.log("There was an error"); } else { console.log("It worked!"); } }); } else { console.log("Could not log in"); } } }); } });
×
×
  • Create New...