xawa Posted April 10, 2019 Report Posted April 10, 2019 (edited) Hello here is my code, 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': 'xx', '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() { this.client.on('webSession', this.trade); this.client.logOn(this.logOnOptions); }; BotHandler.prototype.trade = function(sessionId, cookies) { self.manager.setCookies(cookies, self.getInventory); }; BotHandler.prototype.getInventory = function(error) { if(error) { throw error; return; } 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); console.log(inventory); 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, status) => { if (err) { console.log(err); } else { console.log('trade sent'); console.log(status); } }) }; BotHandler.prototype.acceptTrade = function(error, status) { if(err) { throw error; } if(status == 'pending') { console.log("pending"); }else { console.log('sent'); } }; module.exports = BotHandler; how can i accept auto the outgoing trade in mobile app? I got my identity secret vb in config Edited April 11, 2019 by xawa Quote
Dr. McKay Posted April 10, 2019 Report Posted April 10, 2019 https://github.com/DoctorMcKay/node-steamcommunity/wiki/SteamCommunity#acceptconfirmationforobjectidentitysecret-objectid-callback xawa 1 Quote
xawa Posted April 11, 2019 Author Report Posted April 11, 2019 https://github.com/DoctorMcKay/node-steamcommunity/wiki/SteamCommunity#acceptconfirmationforobjectidentitysecret-objectid-callbackHello master. Thx for your fast reply first of all. When i try this method, it gives an error Like "Must be logged in", idk why im getting this error, on start i did logining is there a something wrong im my code ? Quote
xawa Posted April 11, 2019 Author Report Posted April 11, 2019 https://github.com/DoctorMcKay/node-steamcommunity/wiki/SteamCommunity#acceptconfirmationforobjectidentitysecret-objectid-callback offer.send((err,token, status) => { if (err) { console.log(err); } else { console.log('trade sent'); self.community.acceptConfirmationForObject(self.config.identitySecret); } })I've added self.community.acceptConfirmationForObject Getting this error 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) Quote
Dr. McKay Posted April 11, 2019 Report Posted April 11, 2019 https://dev.doctormckay.com/topic/2102-acceptconfirmationforobject-must-be-logged-in-before-trying-to-do-anything-with-confirmations/ 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.