Jump to content
McKay Development

Recommended Posts

Posted
o.on('connection', (socket) => {
  const clientAddress = socket.handshake.headers['x-forwarded-for'] || socket.handshake.address;
 
  // Check if the client address is localhost or from a permitted IP range
  if (allowedAddresses.includes(clientAddress)) {
    // Connection allowed
    console.log('Client connected from localhost:', clientAddress);
 
    socket.on('startTradeDeposit', (data) => {
      const { assetIDs, steamID } = data;
     
      console.log('Received startTradeDeposit event with NameIDs:', assetIDs);
 
      bot.sendDepositTrade(steamID, assetIDs, (err, success, tradeOffer) => {
        // Log whether the callback is executed
       
        if (err && !success) {
          console.error('Error occurred while sending deposit trade:', err);
          socket.emit('failure', {
            message: 'We could not process your request at this time.'
          });
        } else {
          console.log('Trade offer sent successfully!');
         
        }
      });
 
      bot.manager.on('sentOfferChanged', (offer, oldState) => {
        console.log(TradeOfferManager.ETradeOfferState[offer.state]);
        console.log(oldState)
      });
    });
  }
});

 

  • 3 weeks later...

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