Jump to content
McKay Development

Recommended Posts

Posted

Hi,

im sorry to bother you but i need a litte bit of help. I need to find, how to get my sended offers and to be honest, I dont even know where to start, what function use and even if its possible or if i will need o save every trade i send.

 

Thank you

 

 

Posted

Thank you very much... I have one more question.. Sometimes I get error "Not Logged In", I know I should call logOn when that happen, but is it possible even when i dont have my secrets implemented yet?

 

Error: Not Logged In
    at SteamCommunity.manager._community.httpRequestPost (C:\Works\SteamBot\node_modules\steam-tradeoffer-manager\lib\classes\TradeOffer.js:483:25)
    at Request._callback (C:\Works\SteamBot\node_modules\steamcommunity\components\http.js:67:15)
    at Request.self.callback (C:\Works\SteamBot\node_modules\request\request.js:185:22)
    at emitTwo (events.js:126:13)
    at Request.emit (events.js:214:7)
    at Request.<anonymous> (C:\Works\SteamBot\node_modules\request\request.js:1161:10)
    at emitOne (events.js:116:13)
    at Request.emit (events.js:211:7)
    at IncomingMessage.<anonymous> (C:\Works\SteamBot\ScrapBot\node_modules\request\request.js:1083:12)
    at Object.onceWrapper (events.js:313:30)

 

I need to input my 2 factor everytime I logOn, so I dont know if calling logOn could work if I dont type my 2 factory to console...I found function autoRelogin in Documentation which should be true on defaut, so why I do i even get logout?

Posted

You're not losing your connection to the Steam servers. Your web session has expired. They're two separate things.

 

When you connect to the Steam CM (the server the Steam client connects to), the CM issues you a "nonce" which is then exchanged for web session cookies via the API. Those session cookies can expire, and so you'll need to get new ones from your still-connected connection to the CM. That's what webLogOn is for.

 

This is exactly what's happening when you see this in your Steam client:

 

zABNw.png

 

Your client is still connected, but the web session is expired. So it needs to get new cookies.

Posted (edited)

community.on('sessionExpired', (err) => {
    console.log("Relogging.");
    client.webLogOn((err) => {
        if (err) {
            throw err;
        }
    });
});

So something like this should work, right?

But this dont cover up if steam goes down, right? Then it should emit something like error >400 but how to cover it up in the code? Sorry, im new in

Node.

 

EDIT: Okay, i still getting Not Logged In, i think im doing my callback wrong.

 

 

const logOnOptions = {
    accountName: XXX,
    password: XXX,
};

client.logOn(logOnOptions);

client.on('loggedOn', () => {
    console.log('Logged into Steam');
});

client.on('webSession', (sessionid, cookies) => {
    manager.setCookies(cookies, (err) => {
        if (err) {
            throw err;
        }
    });
    community.setCookies(cookies, (err) => {
        if (err) {
            throw err;
        }
    });
});

community.on('sessionExpired', (err) => {
    console.log("Relogging.");
    client.webLogOn((err) => {
        if (err) {
            throw err;
        }
    });
});

manager.on('newOffer', offer => {
    console.log("You get a trade offer")
    if (offer.itemsToGive.length === 0) {
        offer.accept((err, status) => {
            if (err) {
                console.log(err);
            } else {
                console.log(`Donation accepted`);
            }
        });
    }
    else if (isVerified(offer.partner.getSteamID64())) {
        offer.accept((err, status) => {
            if (err) {
                console.log(err);
            } else {
                console.log(`Accepted offer.`);
            }
        });
    }
    if (pendingCaseOffer == false) {
        SellCheap()
    }
})
Edited by mrkafr

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...
×
×
  • Create New...