Shiny Posted June 3, 2020 Report Posted June 3, 2020 (edited) I want to send trade offer where i add only somebody's item. function sendSomeItem() { const partner = '76561198989375284'; const appid = 730; const contextid = 2; const offer = manager.createOffer(partner); manager.loadInventory(appid, contextid, true, (err, myInv) => { if (err) { console.log(err); } else { manager.loadUserInventory(partner, appid, contextid, true, (err, theirInv) => { if (err) { console.log(err); } else { offer.addTheirItem({ 'assetid': 18697938160, 'appid': appid, 'contextid': contextid }); offer.setMessage('Test offer'); offer.send((err, status) => { if (err) { console.log(err); } else { console.log(`Sent offer. Status: ${status}.`); } }); } }); } }); } I use this simple code to test my code. It logging me, and after delay, trying to send a trade offer. client.logOn(logInOptions); client.on('loggedOn', () => { console.log('logged on'); setTimeout(sendSomeItem, 5000); }); But i get this error: logged on Error: Malformed response at SteamCommunity.<anonymous> (C:\Users\jmazu\Desktop\node-steam-bot\node_modules\steamcommunity\components\users.js:353:15) at Request._callback (C:\Users\jmazu\Desktop\node-steam-bot\node_modules\steamcommunity\components\http.js:67:15) at Request.self.callback (C:\Users\jmazu\Desktop\node-steam-bot\node_modules\request\request.js:185:22) at Request.emit (events.js:315:20) at Request.<anonymous> (C:\Users\jmazu\Desktop\node-steam-bot\node_modules\request\request.js:1154:10) at Request.emit (events.js:315:20) at Gunzip.<anonymous> (C:\Users\jmazu\Desktop\node-steam-bot\node_modules\request\request.js:1076:12) at Object.onceWrapper (events.js:421:28) at Gunzip.emit (events.js:327:22) at endReadableNT (_stream_readable.js:1221:12) I don't know what is wrong. Logging works fine. Edited June 4, 2020 by Shiny Code change Quote
Dr. McKay Posted June 4, 2020 Report Posted June 4, 2020 What's the purpose of loading the user's inventory if you aren't doing anything with the response? Also, I'd like to know what your partner variable actually looks like. Quote
Shiny Posted June 4, 2020 Author Report Posted June 4, 2020 I edited the code so you can see my partner variable. I thought that i must load somebody's inventory to add their items and the partner is his profile id. Quote
Dr. McKay Posted June 4, 2020 Report Posted June 4, 2020 You don't need to load someone's inventory if you know the asset ID you plan on putting in the trade offer already. Can you determine which line you're receiving the error on? That error could be coming from either manager.loadInventory or manager.loadUserInventory. Quote
Shiny Posted June 4, 2020 Author Report Posted June 4, 2020 I deleted useless code function sendSomeItem() { console.log('function started') const partner = '76561198989375284'; const appid = 730; const contextid = 2; const offer = manager.createOffer(partner); offer.addTheirItem({ 'assetid': 18697938160, 'appid': appid, 'contextid': contextid }); offer.setMessage('Test offer'); offer.send((err, status) => { if (err) { console.log(err); } else { console.log(`Sent offer. Status: ${status}.`); } }); } Now i get function started and error that i must have steam guard for at least 15 days. So i think this is working Thank you so much for that fast answers <3 Dr. McKay 1 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.