Jump to content
McKay Development

Recommended Posts

Posted (edited)

Got error called "Error: Invalid input SteamID [object Object]" and don't know what to do...

My code:

manager.getUserInventoryContents(offer.partner.getSteamID64(), 440, 2, true, function (err, myInv){
                  if (err) {
                      console.log(err);
                  } else {
                      // I need to send X ref
                      var volume = entryCost; // amount = number in args[2]
                      // Filter out all the ref
                      var ref = myInv.filter(function (item) {
                          return item.market_hash_name.match('Mann Co. Supply Crate Key')
                      });

                      // Let the user know we don't have enough ref
                      if (ref.length < volume) {
                          unmuteChannel();
                          console.log('Not enough Keys');
                          message.reply(notEnough);
                          console.log('------------------------');
                          return true; // Give up
                      }

                      // Start a new trade offer


                      // Add what we should to the current trade
                      console.log('Adding '+volume+' Keys');
                      offer.addTheirItems(ref.slice(0, volume))

                      // Send the offer
                      offer.send(function (err, status){
                          if (err) {
                              console.log(err);
                          } else {
                              console.log('Trade offer #'+ offer.id+ ' sent successfully');
                              // Register the offer id, save it to JSON file
                              client.tradeLinks ['lastguy'] = {
                                name: message.author.tag,
                                tradelink: _message,
                                lastoffer: offer.id
                              }
                              fs.writeFile ('tradeLinks.json', JSON.stringify(client.tradeLinks, null, 4), err => {
                                if (err) throw err;
                              })

                              message.reply(readyOffer + offer.id + '>');
                              // Cancels after 2 minutes
                              offer.data('cancelTime', 120000);

                              // Starts the function myTimer() every 3 seconds to know the status thats on start
                              var myVar = setInterval(myTimer, 3000);

                              function myTimer() {
                                if (ifvartruefalse === "canceled") {
                                  clearInterval(myVar);
                                  ifvartruefalse = "";
                                  message.channel.send(cancelOffer);
                                  unmuteChannel();
                                  console.log('------------------------');
                                  return;
                                }
                                  else if (ifvartruefalse === "false"){
                                    clearInterval(myVar);
                                    ifvartruefalse = "";
                                    message.reply(deletingCF);
                                    unmuteChannel();
                                    console.log('------------------------');
                                    return;
                                }
                                  else if (ifvartruefalse === "invalid"){
                                    clearInterval(myVar);
                                    ifvartruefalse = "";
                                    message.reply(invalidItems);
                                    unmuteChannel();
                                    console.log('------------------------');
                                    return;
                                }
                                  else if (ifvartruefalse === "true"){
                                    clearInterval(myVar);
                                    ifvartruefalse = "";
                                    message.channel.send(joined);
                                    unmuteChannel();
                                    var theTimeout;                                        
                                 }
                                 return;
                               }
                             }

                       });
                   }
               });

 

Edited by EnelGy

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...