Jump to content
McKay Development

Recommended Posts

Posted

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.

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