Jump to content


Photo

Issues with getting post-trade assetid's

node.js node-steam-tradeoffer-manager

  • Please log in to reply
2 replies to this topic

#1 Eradicate

Eradicate

    Member

  • Member
  • PipPip
  • 25 posts

Posted 19 April 2018 - 06:18 PM

Hi, I'm trying to get the assetid after the sentOfferChanged notices an accepted error, the code that I'm currently using logs the old assetid (at least thats what I think) instead of the new one. What seems to be the issue?

Should offer.itemsToReceive be changed to something else, as this basically says ToReceive as in still have to get as in these assetids will not be updated?

Code:
 

 manager.on('sentOfferChanged', function(offer) {  
        var state = offer.state;

        //check for deposit or witrhdrawl, if withdrawl refund to their inventory.
        if(state === 3){
          console.log('[SteamBot] A sent offer was accepted.');   

          var items = offer.itemsToReceive,
              user = offer.partner.getSteamID64(),
              socket = server.getSocket(user);

          items.forEach(function(item){
            database.query('INSERT INTO `inventories` SET `assetid` = ' + database.pool.escape(item.assetid) + ', `market_hash_name` = ' + database.pool.escape(item.market_hash_name) + ', `user` = ' + database.pool.escape(user) + ', `image` = ' + database.pool.escape(item.icon_url) + ', `status` = 1, `bot` = ' + database.pool.escape(data.id), function(error, call) {
              if(error){
                return;
              }
            });
          });

          server.showAlert(socket, 'success', 'Transaction was successfully completed.');
        }
      });

Thanks in advance.



#2 Dr. McKay

Dr. McKay

    Developer

  • Administrator
  • 1,721 posts

Posted 19 April 2018 - 06:21 PM

itemsToReceive always contains the pre-trade data. You can use offer.getExchangeDetails to get post-trade data.



#3 Eradicate

Eradicate

    Member

  • Member
  • PipPip
  • 25 posts

Posted 19 April 2018 - 06:35 PM

itemsToReceive always contains the pre-trade data. You can use offer.getExchangeDetails to get post-trade data.

Oh, Thanks, do I just replace it? I'll test it out tommorow.







Also tagged with one or more of these keywords: node.js, node-steam-tradeoffer-manager

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users