Guertin Posted September 21, 2016 Report Posted September 21, 2016 Hi, I am trying to use your library for a trade bot. Connexion works but the newOffer never emit. I started the bot, bought an item on opskins and waiting for some logs. Here is my code: 'use strict' var SteamUser = require('steam-user'); var TradeOfferManager = require('steam-tradeoffer-manager'); var client = new SteamUser(); var offers = new TradeOfferManager({ steam: client, domain: "localhost", language: "en", pollInterval: 10000, cancelTime: 300000 }); client.logOn({ accountName: "**account**", password: "**password**" }); client.on('loggedOn', function (details) { console.log("Logged into Steam as " + client.steamID.getSteam3RenderedID()); }); client.on('error', function (e) { console.error(e); process.exit(1); }); client.on('accountLimitations', function (limited, communityBanned, locked, canInviteFriends) { if (limited) { console.warn("Our account is limited. We cannot send friend invites, use the market, open group chat, or access the web API."); } if (communityBanned){ console.warn("Our account is banned from Steam Community"); } if (locked){ console.error("Our account is locked. We cannot trade/gift/purchase items, play on VAC servers, or access Steam Community. Shutting down."); process.exit(1); } if (!canInviteFriends){ console.warn("Our account is unable to send friend requests."); } }); offers.on('newOffer', function (offer) { console.log("New offer #"+ offer.id +" from "+ offer.partner.getSteam3RenderedID()); if (offer.itemsToGive.length === 0) { console.log("User "+ offer.partner.getSteam3RenderedID() +" offered a valid trade. Trying to accept offer."); offer.accept(function (err) { if (err) { console.error("Unable to accept offer "+ offer.id +": " + err.message); } else { console.log("Offer accepted"); } }); } else { console.log("User "+ offer.partner.getSteam3RenderedID() +" offered an invalid trade. Declining offer."); offer.decline(function (err) { if (err) { console.error("Unable to decline offer "+ offer.id +": " + err.message); } else { console.debug("Offer declined"); } }); } }); offers.on('receivedOfferChanged', function (offer, oldState) { console.log(offer.partner.getSteam3RenderedID() +" Offer #" + offer.id + " changed: " + TradeOfferManager.getStateName(oldState) + " -> " + TradeOfferManager.getStateName(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(', ')); } }); } }); Quote
Dr. McKay Posted September 21, 2016 Report Posted September 21, 2016 You never called setCookies on your offer manager. Listen for the webSession event on the SteamUser for your cookies. Quote
Guertin Posted September 22, 2016 Author Report Posted September 22, 2016 Working just fine now. Thank you for you fast response! I was wondering if using steam-user and steam-tradeoffer-manager is bannable by steam and if this is secure (Account thief)? Quote
Dr. McKay Posted September 22, 2016 Report Posted September 22, 2016 It's secure as long as you properly secure your code and servers. Valve won't ban you for using this. Quote
Recommended Posts
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.