Jump to content


Photo
Question

Find sended offers

node.js node-steam-tradeoffer-manager

  • Please log in to reply
4 replies to this topic

#1 mrkafr

mrkafr

    Newbie

  • Member
  • Pip
  • 3 posts

Posted 26 December 2018 - 11:03 AM

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

 

 



#2 Dr. McKay

Dr. McKay

    Developer

  • Administrator
  • 1,998 posts

Posted 26 December 2018 - 09:28 PM

https://github.com/D...cutoff-callback



#3 mrkafr

mrkafr

    Newbie

  • Member
  • Pip
  • 3 posts

Posted 27 December 2018 - 02:43 PM

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?



#4 Dr. McKay

Dr. McKay

    Developer

  • Administrator
  • 1,998 posts

Posted 28 December 2018 - 12:05 AM

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.



#5 mrkafr

mrkafr

    Newbie

  • Member
  • Pip
  • 3 posts

Posted 29 December 2018 - 12:06 PM

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, 30 December 2018 - 06:41 AM.






Also tagged with one or more of these keywords: Question, node.js, node-steam-tradeoffer-manager

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users