Jump to content
McKay Development

TypeError: Cannot read property 'addTheirItems' of undefined


Recommended Posts

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 by woepertjes
Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...