Jump to content
McKay Development

Search the Community

Showing results for tags 'filter items'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • News & Announcements
    • Releases & Updates
  • Help & Support
    • General
    • Guides
    • node-steam-user
    • node-steamcommunity
    • node-steam-tradeoffer-manager
    • node-steam-session

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Website URL


Skype


Location


Interests

Found 1 result

  1. I have this code here mostly from the example in the steam trade offer manager. It accepts all trade offers fine (without any exceptions). I added some code where the bot would skip the trade offer if the bot didn't receive any items (a gift offer). I'm struggling to create the part of code where I can filter items and create the prices for them for buy orders and sell orders. Could anyone tell me the syntax for that? CODE SO FAR //TF2 TRADE BOTvar SteamUser = require('steam-user'); var SteamCommunity = require('steamcommunity'); var SteamTotp = require('steam-totp'); var TradeOfferManager = require('steam-tradeoffer-manager'); var fs = require('fs'); require('consoleplusplus') var client = new SteamUser(); var manager = new TradeOfferManager({ "steam": client, "domain": "example.com", "language": "en" }) var community = new SteamCommunity(); // Steam logon var logOnOptions = { "accountName": "username", "password": "password", "twoFactorCode": SteamTotp.getAuthCode("sharedSecret") }; if (fs.existsSync('polldata.json')) { manager.pollData = JSON.parse(fs.readFileSync('polldata.json')); } client.logOn(logOnOptions); client.on('loggedOn', function() { var logonmessage = "#magenta{LOGGED INTO STEAM SUCCESSFULLY}" console.info(logonmessage); }); client.on('webSession', function(sessionID, cookies) { manager.setCookies(cookies, function(err) { if (err) { console.error(err); process.exit(1); return; } console.info("Got API key: " + manager.apiKey); console.log("________________________________________________________________________________") }); community.setCookies(cookies); community.startConfirmationChecker(30000, "identitySecret"); }); manager.on('newOffer', function(offer) { console.info("New offer #" + offer.id + " from " + offer.partner.getSteam3RenderedID()); offer.accept(function(err) { if (err) { console.error("Unable to accept offer: " + err.message); } else { if(offer.itemsToReceive.length === 0) { // Gift offer console.info(offer.partner.getSteam3RenderedID() + " Offer #" + offer.id + " is a gift offer, skipping"); return; }else{ community.checkConfirmations(); console.log("Offer accepted"); } } }); }); manager.on('receivedOfferChanged', function(offer, oldState) { console.info(`Offer #${offer.id} changed: ${TradeOfferManager.ETradeOfferState[oldState]} -> ${TradeOfferManager.ETradeOfferState[offer.state]}`); if (offer.state == TradeOfferManager.ETradeOfferState.Accepted) { offer.getReceivedItems(function(err, items) { if (err) { console.error("Couldn't get received items: " + err); } else { var names = items.map(function(item) { return item.name; }); console.log("Received: " + names.join(', ')); console.log("________________________________________________________________________________") } }); } }); manager.on('pollData', function(pollData) { fs.writeFile('polldata.json', JSON.stringify(pollData)); });
×
×
  • Create New...