DoctorMcKay/node-steam-tradeoffer-manager

[Suggestion] Improve 'offloader.js' example

Gesh4o opened this issue · 2 comments

Hello doc,

First of all - I am really grateful for having all of your libraries up there - you save all of us a lot of time energy and head bashing - so thank you!

I am new to the steam api ecosystem and I am trying to work with all the perks and quirks of it. I used your demo code in offloader.js (https://github.com/DoctorMcKay/node-steam-tradeoffer-manager/blob/master/examples/offloader.js) to build my very first steam bot and sometimes I was not able to login as my console was prompted for a steam guard code when it was already given in the loginOptions. After little research I found out that it is connected to: DoctorMcKay/node-steam-user#189.

Could we add something like this in the example:
`steamUser.on("steamGuard", function(domain, callback, lastCodeWrong) {

console.log("Steam Guard code needed from mobile (main bot)");

if(lastCodeWrong) {
    console.log("Last code wrong, try again!");
    setTimeout(function() {
        console.log(SteamTotp.getAuthCode("shared_secret"));                      
        callback(SteamTotp.getAuthCode("shared_secret"));
    }, 30000);
}

});
`

This is a solution provided from the issue above. What do you think about my suggestion?
I can make a pull request if you want.

Closing because of lack of response.

I don't think this needs to be closed. I haven't responded because this has been fairly low on my priority list, not because I don't think it's a good idea.