xawa Posted April 11, 2019 Report Posted April 11, 2019 hello const SteamUser = require('steam-user'); const SteamCommunity = require('steamcommunity'); const SteamTotp = require('steam-totp'); const TradeManager = require('steam-tradeoffer-manager'); var self = null; var BotHandler = function(botConfig, tradeUrl, ownItems = "15702927052", theirItems= "") { this.tradeUrl = tradeUrl; this.ownItems = ownItems; this.theirItems = theirItems; this.config = botConfig; this.client = new SteamUser(); this.manager = new TradeManager({ 'steam': this.client, 'domain': 'skins.company', 'language': 'tr' }); this.community = new SteamCommunity(); this.logOnOptions = { 'accountName': botConfig.username, 'password': botConfig.password, 'twoFactorCode': SteamTotp.getAuthCode(botConfig.secret) }; self = this; }; BotHandler.prototype.start = function() { self.client.on('webSession', this.trade); self.client.logOn(self.logOnOptions); }; BotHandler.prototype.trade = function(sessionId, cookies) { self.manager.setCookies(cookies, self.getInventory); }; BotHandler.prototype.getInventory = function(error) { if(error) { throw error; } self.manager.getInventoryContents(self.config.appId, self.config.contextId, true, self.createOffer); }; BotHandler.prototype.createOffer = function(error, inventory) { if(error) { throw error; } var offer = self.manager.createOffer(self.tradeUrl); offer.addMyItem({ assetid: "15702927030", appid: self.config.appId, contextid: self.config.contextId, amount: 1 }); // for(var i = 0; i < self.ownItems.length; i++) { // offer.addMyItem({ // assetid: self.ownItems[i], // appid: self.config.appId, // contextid: self.config.contextId, // amount: 1 // }); // } // offer.addTheirItem({ // assetid: self.theirItems, // appid: self.config.appId, // contextid: self.config.contextId, // amount: 1 // }); // for(var i = 0; i < self.theirItems.length; i++) { // offer.addTheirItem({ // assetid: self.theirItems[i], // appid: self.config.appId, // contextid: self.config.contextId, // amount: 1 // }); // } offer.send((err,token, status) => { if (err) { console.log(err); } else { console.log('trade sent'); self.community.acceptConfirmationForObject(self.config.identitySecret); // HERE IS THE METHOD } }) }; // BotHandler.prototype.acceptTrade = function(error, status) { // if(err) { // throw error; // } // // if(status == 'pending') { // console.log("pending"); // }else { // console.log('sent'); // } // }; module.exports = BotHandler; ERROR Output F:\Xamp\htdocs\steam-trade-bot\node_modules\steamcommunity\components\confirmations.js:247 throw new Error("Must be logged in before trying to do anything with confirmations"); ^ Error: Must be logged in before trying to do anything with confirmations at request (F:\Xamp\htdocs\steam-trade-bot\node_modules\steamcommunity\components\confirmations.js:247:9) at SteamCommunity.getConfirmations (F:\Xamp\htdocs\steam-trade-bot\node_modules\steamcommunity\components\confirmations.js:17:2) at doConfirmation (F:\Xamp\htdocs\steam-trade-bot\node_modules\steamcommunity\components\confirmations.js:182:8) at F:\Xamp\htdocs\steam-trade-bot\node_modules\steamcommunity\components\confirmations.js:170:4 at IncomingMessage.<anonymous> (F:\Xamp\htdocs\steam-trade-bot\node_modules\steamcommunity\node_modules\steam-totp\index.js:129:4) at IncomingMessage.emit (events.js:194:15) at endReadableNT (_stream_readable.js:1103:12) at process._tickCallback (internal/process/next_tick.js:63:19) F:\Xamp\htdocs\steam-trade-bot>node bot.js --botId 0 --tradeUrl "https://steamcommunity.com/tradeoffer/new/?partner=100331693&token=a6vNScw-" --ownList "5854236464" --theirList "15702811262" Promise { <pending> } Error: SteamGuardMobile at SteamCommunity.<anonymous> (F:\Xamp\htdocs\steam-trade-bot\node_modules\steamcommunity\index.js:153:14) at Request._callback (F:\Xamp\htdocs\steam-trade-bot\node_modules\steamcommunity\components\http.js:67:15) at Request.self.callback (F:\Xamp\htdocs\steam-trade-bot\node_modules\request\request.js:185:22) at Request.emit (events.js:189:13) at Request.<anonymous> (F:\Xamp\htdocs\steam-trade-bot\node_modules\request\request.js:1161:10) at Request.emit (events.js:189:13) at Gunzip.<anonymous> (F:\Xamp\htdocs\steam-trade-bot\node_modules\request\request.js:1083:12) at Object.onceWrapper (events.js:277:13) at Gunzip.emit (events.js:194:15) at endReadableNT (_stream_readable.js:1103:12) trade sent F:\Xamp\htdocs\steam-trade-bot\node_modules\steamcommunity\components\confirmations.js:247 throw new Error("Must be logged in before trying to do anything with confirmations"); ^ Error: Must be logged in before trying to do anything with confirmations at request (F:\Xamp\htdocs\steam-trade-bot\node_modules\steamcommunity\components\confirmations.js:247:9) at SteamCommunity.getConfirmations (F:\Xamp\htdocs\steam-trade-bot\node_modules\steamcommunity\components\confirmations.js:17:2) at doConfirmation (F:\Xamp\htdocs\steam-trade-bot\node_modules\steamcommunity\components\confirmations.js:182:8) at F:\Xamp\htdocs\steam-trade-bot\node_modules\steamcommunity\components\confirmations.js:170:4 at IncomingMessage.<anonymous> (F:\Xamp\htdocs\steam-trade-bot\node_modules\steamcommunity\node_modules\steam-totp\index.js:129:4) at IncomingMessage.emit (events.js:194:15) at endReadableNT (_stream_readable.js:1103:12) at process._tickCallback (internal/process/next_tick.js:63:19) F:\Xamp\htdocs\steam-trade-bot>node bot.js --botId 0 --tradeUrl "https://steamcommunity.com/tradeoffer/new/?partner=100331693&token=a6vNScw-" --ownList "5854236464" --theirList "15702811262" null trade sent F:\Xamp\htdocs\steam-trade-bot\node_modules\steamcommunity\components\confirmations.js:247 throw new Error("Must be logged in before trying to do anything with confirmations"); ^ Error: Must be logged in before trying to do anything with confirmations at request (F:\Xamp\htdocs\steam-trade-bot\node_modules\steamcommunity\components\confirmations.js:247:9) at SteamCommunity.getConfirmations (F:\Xamp\htdocs\steam-trade-bot\node_modules\steamcommunity\components\confirmations.js:17:2) at doConfirmation (F:\Xamp\htdocs\steam-trade-bot\node_modules\steamcommunity\components\confirmations.js:182:8) at F:\Xamp\htdocs\steam-trade-bot\node_modules\steamcommunity\components\confirmations.js:170:4 at IncomingMessage.<anonymous> (F:\Xamp\htdocs\steam-trade-bot\node_modules\steamcommunity\node_modules\steam-totp\index.js:129:4) at IncomingMessage.emit (events.js:194:15) at endReadableNT (_stream_readable.js:1103:12) at process._tickCallback (internal/process/next_tick.js:63:19) F:\Xamp\htdocs\steam-trade-bot>node bot.js --botId 0 --tradeUrl "https://steamcommunity.com/tradeoffer/new/?partner=100331693&token=a6vNScw-" --ownList "5854236464" --theirList "15702811262" F:\Xamp\htdocs\steam-trade-bot\BotHandler.js:46 console.log(self.client.steamID); ^ TypeError: Cannot read property 'client' of null at Object.<anonymous> (F:\Xamp\htdocs\steam-trade-bot\BotHandler.js:46:18) at Module._compile (internal/modules/cjs/loader.js:689:30) at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10) at Module.load (internal/modules/cjs/loader.js:599:32) at tryModuleLoad (internal/modules/cjs/loader.js:538:12) at Function.Module._load (internal/modules/cjs/loader.js:530:3) at Module.require (internal/modules/cjs/loader.js:637:17) at require (internal/modules/cjs/helpers.js:22:18) at Object.<anonymous> (F:\Xamp\htdocs\steam-trade-bot\bot.js:3:18) at Module._compile (internal/modules/cjs/loader.js:689:30) F:\Xamp\htdocs\steam-trade-bot>node bot.js --botId 0 --tradeUrl "https://steamcommunity.com/tradeoffer/new/?partner=100331693&token=a6vNScw-" --ownList "5854236464" --theirList "15702811262" SteamID { universe: 1, type: 1, instance: 1, accountid: 971243084 } trade sent F:\Xamp\htdocs\steam-trade-bot\node_modules\steamcommunity\components\confirmations.js:247 throw new Error("Must be logged in before trying to do anything with confirmations"); ^ Error: Must be logged in before trying to do anything with confirmations at request (F:\Xamp\htdocs\steam-trade-bot\node_modules\steamcommunity\components\confirmations.js:247:9) at SteamCommunity.getConfirmations (F:\Xamp\htdocs\steam-trade-bot\node_modules\steamcommunity\components\confirmations.js:17:2) at doConfirmation (F:\Xamp\htdocs\steam-trade-bot\node_modules\steamcommunity\components\confirmations.js:182:8) at F:\Xamp\htdocs\steam-trade-bot\node_modules\steamcommunity\components\confirmations.js:170:4 at IncomingMessage.<anonymous> (F:\Xamp\htdocs\steam-trade-bot\node_modules\steamcommunity\node_modules\steam-totp\index.js:129:4) at IncomingMessage.emit (events.js:194:15) at endReadableNT (_stream_readable.js:1103:12) at process._tickCallback (internal/process/next_tick.js:63:19) F:\Xamp\htdocs\steam-trade-bot>node bot.js --botId 0 --tradeUrl "https://steamcommunity.com/tradeoffer/new/?partner=100331693&token=a6vNScw-" --ownList "5854236464" --theirList "15702811262" Promise { <pending> } trade sent F:\Xamp\htdocs\steam-trade-bot\node_modules\steamcommunity\components\confirmations.js:247 throw new Error("Must be logged in before trying to do anything with confirmations"); ^ Error: Must be logged in before trying to do anything with confirmations at request (F:\Xamp\htdocs\steam-trade-bot\node_modules\steamcommunity\components\confirmations.js:247:9) at SteamCommunity.getConfirmations (F:\Xamp\htdocs\steam-trade-bot\node_modules\steamcommunity\components\confirmations.js:17:2) at doConfirmation (F:\Xamp\htdocs\steam-trade-bot\node_modules\steamcommunity\components\confirmations.js:182:8) at F:\Xamp\htdocs\steam-trade-bot\node_modules\steamcommunity\components\confirmations.js:170:4 at IncomingMessage.<anonymous> (F:\Xamp\htdocs\steam-trade-bot\node_modules\steamcommunity\node_modules\steam-totp\index.js:129:4) at IncomingMessage.emit (events.js:194:15) at endReadableNT (_stream_readable.js:1103:12) at process._tickCallback (internal/process/next_tick.js:63:19) What should i do? The trade offer successfully sending , but cant accept automatically outgoing offer Quote
Dr. McKay Posted April 11, 2019 Report Posted April 11, 2019 You never set cookies on your SteamCommunity instance. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.