Jump to content
McKay Development

Recommended Posts

Posted
const SteamUser = require('steam-user');
const SteamTotp = require('steam-totp');
const SteamCommunity = require('steamcommunity');
const TradeOfferManager = require('steam-tradeoffer-manager');


const client = new SteamUser();
const community = new SteamCommunity();
const manager = new TradeOfferManager({
  steam: client,
  community: community,
  language: 'en'
});

const logInOptions = {
  accountName: "........",
  password: "...........",
  twoFactorCode: SteamTotp.generateAuthCode("............")
};

client.logOn(logInOptions);

client.on('loggedOn', () => {
  console.log('logged on');
client.setPersona(SteamUser.EPersonaState.Online, "bot1");
client.gamesPlayed(570);
});
client.on('webSession', (sid, cookies) => {
console.log(cookies);
  manager.setCookies(cookies);
  community.setCookies(cookies);
  community.startConfirmationChecker(10000, "............");
  mytrade();
});

manager.on('newOffer', offer => {
  console.log('offer detected');
  if (offer.partner.getSteamID64() === '.............') {
    offer.accept((err, status) => {
      if (err) {
        console.log(err);
      } else {
        console.log(status);
      }
    })
  } else {
    console.log('unknown sender');
    offer.decline(err => {
      if (err) {
        console.log(err);
      } else {
        console.log('trade from stranger declined');
      }
    });
  }
});

function mytrade() {
manager.getOfferToken((err, token) => {
if (err) {
console.log("gsfgfasy", err)
}
else {
var partner="id........"
const offer = manager.createOffer('id.....',token);
manager.getUserInventoryContents(partner,570, 2, true, (err, myInv) => {
if (err) {
console.log(err);
} else {
console.log("myenv",myInv[0]);
// myInv.forEach(function(item) {
offer.addTheirItem(myInv[0]);
offer.setMessage('You received a floral shirt!');
offer.send((err, status) => {
if (err) {
console.log(err);
} else {
console.log('trade sent');
console.log(status);
}
})
 
 
// })
}
})


}
})
}

 

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