Jump to content
McKay Development

Unable to get polling to work


Recommended Posts

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 by troffaholic
add more info
Link to comment
Share on other sites

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?

Link to comment
Share on other sites

  • 2 weeks later...
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. 

Link to comment
Share on other sites

  • 2 weeks later...
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 by troffaholic
add more info
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...