woepertjes Posted March 20, 2018 Report Posted March 20, 2018 (edited) I'm trying to make a function, which gets called when the specified command is entered. function code: function tradecases(botid, senderid) { var appid = 730; var contextid1 = 2; bots[botid].offers.loadUserInventory(senderid, appid, contextid1, true, (err, theirInv) => { if (err) { logger.error(err); } else { var theirItem = theirInv bots[botid].offers.offer.addTheirItems({ 'appid': appid, 'contextid': contextid1 }); bots[botid].offers.offer.setMessage('This is an automated tradeoffer for all your trading cards. You can change it if you want.'); bots[botid].offers.offer.send((err, status) => { if (err) { logger.error(err); } else logger.info('sent offer status: ' + status); }); } }); } Error (error shows up in CMD): verbose: [B1] Received message from non-botadmin: !casedonate F:\va\Steam bots\main.js:240 bots[botid].offers.offer.addTheirItems({ ^ TypeError: Cannot read property 'addTheirItems' of undefined at bots.(anonymous function).offers.loadUserInventory (F:\va\ Steam bots\main.js:240:44) at SteamCommunity.<anonymous> (F:\va\node_modules\steamcommun ity\components\users.js:342:5) at Request._callback (F:\va\node_modules\steamcommunity\compo nents\http.js:67:15) at Request.self.callback (F:\va\node_modules\request\request. js:186:22) at Request.emit (events.js:180:13) at Request.<anonymous> (F:\va\node_modules\request\request.js :1163:10) at Request.emit (events.js:180:13) at IncomingMessage.<anonymous> (F:\va\node_modules\request\re quest.js:1085:12) at Object.onceWrapper (events.js:272:13) at IncomingMessage.emit (events.js:185:15) Could someone maybe give me advice, help, suggestions on how to fix this error? Extra info:Bots log in perfectly, nothing goes wrong.Bots are online.There is a second command like this but that one is meant for steam trading cards. This command has the same issues. All help is appreciated <3 Edited March 20, 2018 by woepertjes Quote
Dr. McKay Posted March 21, 2018 Report Posted March 21, 2018 offers.offer isn't valid. You need to use offers.createOffer which returns an offer object. Quote
woepertjes Posted March 21, 2018 Author Report Posted March 21, 2018 That worked! Thank you very much! <3 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.