Jump to content
McKay Development

Automatically accepts all trade offers, but it doesn't have to


Recommended Posts

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 logOnOptions = {
accountName: 'hereismylogin',
password: 'hereismypassword',
twoFactorCode: SteamTotp.generateAuthCode('hereismysharedsecret')
};

client.logOn(logOnOptions);

client.on('loggedOn', () => {
console.log(' > Logged into Steam');
client.setPersona(SteamUser.Steam.EPersonaState.Online);
client.gamesPlayed("Steam Test Bot by Cubson [Not Busy]");
});

client.on('webSession', (sessionid, cookies) => {
    manager.setCookies(cookies, function(err) {
    if (err) return console.log(err);
    console.log(" > Got API key!");
  });
community.setCookies(cookies);
community.startConfirmationChecker(6000, 'hereismyidentitysecret');
});

manager.on('newOffer', (offer) => {
client.gamesPlayed("Steam Test Bot by Cubson [Busy]");
if (offer.partner.getSteamID64() === 'firsttrustedguysteamid' || 'secondtrustedguysteamid') {
offer.accept((err, status) => {
if (err) {
console.log(err);
client.gamesPlayed("Steam Test Bot by Cubson [Not Busy]");
} else {
community.checkConfirmations();
console.log(`Accepted offer. Status: ${status}.`);
client.gamesPlayed("Steam Test Bot by Cubson [Not Busy]");
}
});
}
});

What's wrong? And I'm a very big noob in JavaScript and Node.JS and because of it I beg you to explain everything step-by-step.

 

P.S. Maybe update to IPB 4?

Edited by Cubson
Link to comment
Share on other sites

I experienced this when I withdrawed some things from the site, then I checked status and it told me that everything is fine, items are in steam inventory. I didn't accept the trade by myself and even tried to send it from another account. And it successfully accepted all trades.

Edited by Cubson
Link to comment
Share on other sites

if (offer.partner.getSteamID64() === 'firsttrustedguysteamid' || 'secondtrustedguysteamid') {

is not a valid syntax.

If you wish to compare multiple IDs at once you can always put them in array and use indexOf();

 

Please, give me an example. What does mean "use indexOf()"? Where do I have to use it?

Link to comment
Share on other sites

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

×
×
  • Create New...