seishun / node-steam

Interface directly with Steam servers from Node.js
MIT License
1.01k stars 180 forks source link

Add logOff method. #23

Closed tSpartak closed 11 years ago

tSpartak commented 11 years ago

For example i want to do something like this:

var steam = new Steam.SteamClient();
steam.logOn(loginOne, ...);
steam.on('loggedOn', function(result) {
    console.log('Hello my ID is ' + steam.steamID);
    steam.logOff(function(login){
        if (login == loginOne) {
            steam.logOn(loginTwo, ...);
        }
    });
});
seishun commented 11 years ago

What's your use case? Why do you need to log off your first account before logging into the second one? Why can't you log into both accounts at start?

tSpartak commented 11 years ago

In both accounts i'll do same actions, i want do it synchronous, and having method like this will reduce amount of code. Two accounts is just example.

seishun commented 11 years ago

That's not a use case. I need to know what exactly you're trying to do in the end.

(To clarify, I'm asking this because this might affect the API.)

rjackson commented 11 years ago

I have a use-case which would benefit from this, I have an IRC bot with a Steam plugin, and I want to add a "reload" command to the bot to reload its config without any downtime. To do that I have a reloadConfig hook for all plugins to write logic for; the Steam plugin hooks into this and if the Steam username changes the plugin would try to change the account it is using: the problem here was there is no logOff method, and I couldn't figure out how to terminate the previous Steam instance before spawning a new one - I was ending up with multiple Steam bots online each doing the same job.

The steam plugin in question: https://github.com/RJacksonm1/irc_rbotson/blob/jsonconfig/plugins/steam_relay.js

Yadasko commented 11 years ago

For my part, I'm doing a web interface which permits to control the bot (Launch it, log it, trade with someone ...) and it would be really interesting to have a method to logOff the bot, or to end the bot, when the user has finished with the bot.