troffaholic Posted February 24, 2020 Report Posted February 24, 2020 (edited) Hi, I have been trying to enable polling for a few hours at this point, without any success. I believe polling is not working because neither pollSuccess nor pollFailure are ever emitted. I need to run multiple bots at the same time, so I've created a class for this. Offers are being sent, but even when setting cancelTime in the constructor (and even on the tradeoffers themselves), they are never cancelled. This leads me to believe polling is not done. What am I doing wrong here? The relevant code looks something like this: const SteamTotp = require('steam-totp'); const SteamUser = require('steam-user'); const SteamCommunity = require('steamcommunity'); const TradeOfferManager = require('steam-tradeoffer-manager'); class Bot { constructor (accountName, sharedSecret, identitySecret) { this.accountName = accountName; this.sharedSecret = sharedSecret; this.identitySecret = identitySecret; this.user = new SteamUser(); this.community = new SteamCommunity(); this.manager = new TradeOfferManager({ steam: this.user, community: this.community, language: 'en', pollInterval: 5000, cancelTime: 120000, cancelOfferCount: 20 }); this.user.logOn({ accountName, proccess.env.STEAM_PASSWORD }); this.user.on('steamGuard', (domain, callback) => { const code = SteamTotp.generateAuthCode(sharedSecret); callback(code); }); this.user.on('webSession', (sessionid, cookies) => { this.manager.setCookies(cookies); this.community.setCookies(cookies); }); this.manager.on('pollSuccess', () => { console.log('Poll success!'); }); this.manager.on('pollFailure', (error) => { console.log('Poll failure!\n' + error); }); } } ... Thanks in advance for all and any help! Edited February 24, 2020 by troffaholic add more info Quote
Dr. McKay Posted February 24, 2020 Report Posted February 24, 2020 Try adding a callback to this.manager.setCookies and see if you're getting an error there. If you aren't, add this.manager.on('debug', console.log) and paste whatever output you get. Quote
troffaholic Posted February 24, 2020 Author Report Posted February 24, 2020 Thanks, adding the callback reveals I was getting the Access Denied error. Reading the docs I can see that this error indicates the account is limited, which is true. I'll switch it out for a non-limited account and try again, hopefully it will work this time. Just a quick question, why are limited accounts not able to do polling? Why is an API key necessary for this? Quote
Dr. McKay Posted February 25, 2020 Report Posted February 25, 2020 Polling uses the WebAPI, so an API key is required. Quote
vrtgn Posted March 5, 2020 Report Posted March 5, 2020 On 2/24/2020 at 9:56 AM, troffaholic said: Just a quick question, why are limited accounts not able to do polling? Why is an API key necessary for this? Limited accounts are not allowed to prevent overload e.g. say someone makes a bunch of bots and then spams reqeusts to steam - all for free as well. API keys - verify the user requesting is not limited and see/track who is making the calls and how many. Quote
troffaholic Posted March 18, 2020 Author Report Posted March 18, 2020 (edited) On 3/5/2020 at 8:32 PM, vrtgn said: Limited accounts are not allowed to prevent overload e.g. say someone makes a bunch of bots and then spams reqeusts to steam - all for free as well. API keys - verify the user requesting is not limited and see/track who is making the calls and how many. Thanks for your answer. I know that this is old but I'd just like to point out that limited accounts are (as far as I'm concerned, please correct me if I am wrong) still able to send and receive trade offers, along with a bunch of other features that realistically would also drain a lot of resources. The reason I was confused about the need for an API key is that the official Steam client notifies me instantly whenever I get a new tradeoffer (accessed from the mailbox icon in the top-right corner), even without me (knowingly) registering an API key. How is the client being notified of a new tradeoffer? I have not looked into this whatsoever and I'm guessing this is some other endpoint or that it is built upon another system, but I cannot quite figure out the difference between the two. Edited March 18, 2020 by troffaholic add more info Quote
Dr. McKay Posted March 19, 2020 Report Posted March 19, 2020 The CM sends a notification message to the Steam client (which steam-user can receive), but that message only contains the count of pending trade offers. To get any details at all about the actual content of the trade, we need to hit the API for that. vrtgn 1 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.