Jump to content
McKay Development

Frost Byte

Member
  • Posts

    18
  • Joined

  • Last visited

Profile Information

  • Gender
    Male

Frost Byte's Achievements

  1. I'm sorry, but I have no clue what you meant with your last sentence... I need to keep track of the last time I called webLogOn, but after that you lost me Do you mean that I can only use webLogOn if my session has expired and it doesn't work when my session is still running? And I shouldn't link it to the sessionExpired event, because that can be emitted at any frequency?
  2. Ah, wonderful! I was indeed in doubt whether the error from sessionExpired was actually the part that makes us aware that the session expired or whether it was a real error, which would mean that the session was actually still up. Well, that is sorted out now . If I'm right, this should do the trick now: client.on("webSession", function(steamID, cookies) { logger.debug("Got web session"); setInterval(function() { client.webLogOn(); }, 1000*60*60); /* And some more stuff which need cookies */ }); And at the end of the file: // Re-login after a session expires community.on("sessionExpired", function(err) { if (err) { logger.warn("Session expired, trying to re-login"); client.webLogOn(); } }); You suggested the login interval, but do you actually mean the .setInterval or the .setTimeout method? Thanks for your answer!
  3. Alright good to know! Just a little quick question: Will the code the following code be enough to keep the bot running 24/7? // Re-login after a session expires community.on("sessionExpired", function(err) { if (err) { logger.info("Session is still up"); } else { logger.warn("Session expired, trying to re-login"); client.webLogOn(); } }); If not, could you give a suggestion to keep my bot running? That would be extremely helpful and much appreciated. As always, thanks for helping me out every time! You are awesome you know
  4. Thank you very much for your answer and taking the time for it! Now I'm certain that Steam will get some more money from me
  5. If I'm right, the setTimeout method only runs a function once after a specified amount of time, whereas setInterval runs a function every time after a specified amount of time. If my session expires, why would I want to run the webLogOn method only once with setTimeout? And if my session expires another time after the last one, will my bot then just stop working? Or is my reasoning completely wrong now? Besides, I implemented the following code, to keep my session active: // Re-login after a session expires community.on("sessionExpired", function(err) { if (err) { logger.info("Session is still up"); } else { logger.warn("Session expired, trying to re-login"); client.webLogOn(); } }); Will this assure that my Steambot continues to run 24/7 on a Raspberry Pie which will be on 24/7 as well? If not, could you be so kind to give a few suggestions to keep my bot running? It would be awesome to get it working!
  6. Hello everyone! This might have been answered before, but I tried to find it everywhere, but I'm still not 100% sure. I'd like to use my bot with trade offers, however when I try to set the cookies for the tradeoffer-manager, it fails. I'm pretty sure this has to do with my limited account, since it is unable to fetch an API Key. So I'd like to be 100% sure, before I put some money into Steam: Do I need to get rid of the limited status of my account before I can fully use the trade offers? (and is this because we can't fetch the API Key and therefore we can't set the cookies?) Thanks for your help and I hope that this question will help some other people out as well who were just curious or had the same question.
  7. Hello everyone! Just a really quick question. Let's say I want my bot to run 24/7. How can I make sure it won't stop at all? I don't really mean like: 1. Keep your computer / bot running on your local machine 24/7. 2. Buy a VPS and run the bot on that machine. Because that is quite obvious. I mean like, the session not expiring. Is the following code enough to make sure that my steambot runs 24/7 on a Raspberry Pie for example? client.on("webSession", function(steamID, cookies) { logger.debug("Got web session"); setInterval(function() { client.webLogOn(); }, 1000*60*60); /* And some more stuff which need cookies */ });Thanks for your help!
  8. Thanks, that worked once again really well! My code did indeed not work since the callback wasn't a function... I tried to create my own method. function getGuardCode() { return callback(SteamTotp.generateAuthCode(config.sharedsecret)); /* I even tried without return, but that didn't help either */ } setTimeout(getGuardCode(), 30000); But well that didn't work... I know you don't give JavaScript classes, but why does it work when you only have function() { callback(SteamTotp.generateAuthCode(config.sharedsecret)); } Does this 'force' callback to become a function? Or is it like 'Hey, here is now a function. Just use it'?
  9. @Dr. McKay Alright, I just had this problem that the last Steam Guard code was wrong and it tried logging into Steam again like 5 times within 2 seconds. Of course this gave me the RateLimitExceeded error. Could I solve this by adding a setTimeOut before the callback? Basically something like this: // If last Steam Guard Code was wrong, here a new one is created client.on("steamGuard", function(domain, callback, lastCodeWrong) { if(lastCodeWrong) { logger.warn("Last code wrong, try again!"); } logger.warn("Waiting 30 seconds for a new Steam Guard code"); setTimeout(callback(SteamTotp.generateAuthCode(config.sharedsecret)), 30000); });
  10. Alright. I'm not completely sure if this will help you out, but this is what I currently use and it works for me: // Disables asking for Steam Guard Code client.setOption("promptSteamGuardCode", false); // Logs on client.logOn({ "accountName": config.username, "password": config.password }); // If some error occured during logon. Closes the process client.on("error", function (e) { console.log(e); process.exit(1); }); // If last Steam Guard Code was wrong, here a new one is created client.on("steamGuard", function(domain, callback, lastCodeWrong) { if(lastCodeWrong) { console.log("Last code wrong, try again!"); } callback(SteamTotp.generateAuthCode(config.sharedsecret)); }); You will need to use the Steam Desktop Authenticator for this! That can be found here https://github.com/Jessecar96/SteamDesktopAuthenticator Furthermore you need Dr. McKay's node-steam-totp library as well to generate new Steam Guard Codes from the shared_secret. Please do some reasearch about 'shared_secret' and 'identity_secret' and from then on you'll be alright!
  11. Just a noob question, but why would you want to bind an ip to node-steam-user? Does it provide some sort of benefit? And what does it do?
  12. Like Dr. McKay said, you can use the event friendOrChatMessage to find out if someone send you a message, so you can respond to them. I have the other method friendMessage, which will only send something back when you get a message from a friend. // When we get a message, send back a response and log to console client.on("friendMessage", function(steamID, message) { console.log("Friend message from " + steamID+ ": " + message); if (message == "Ping") { client.chatMessage(steamID, "Pong"); console.log("Send back: Pong"); } else { client.chatMessage(steamID, config.greetMsg); console.log("Send back the standard reply"); } }); }); When your bot gets the message 'Ping' it will send back 'Pong'. If your bot gets a different message, it will respond with a standard reply which you should create in your config.json file. If you want more reply options, I'd suggest creating a switch statement with several cases.
  13. I found out myself! You already have the properties and methods from the steam handlers in your own steam-user library. So there I don't need a specific handler like 'friends' to send a message. I can just ask your steam-user object (in my case I called it client) and ask for the chatMessage method. Right? Well it works for me now Yeah, it really works. And I managed to only use your node-steam-user library with all it's functions + your node-steamcommunity library!
  14. Hey! Thanks for explaining. I'm slowly but surely getting the hang of it. I'm indeed using node-steam's friends handler alongside SteamUser. The reason for this is that in FirePowered's article, they address the friends handler with 'client.friends' In the comments of that article, you stated that you removed this feature in v2.0.0, but I did not find another way to access it again. Therefore I currently use: var Steam = require('steam'); var SteamUser = require('steam-user'); var SteamCommunity = require('steamcommunity'); var client = new SteamUser(); var steamClient = new Steam.SteamClient(); var steamUser = new Steam.SteamUser(steamClient); var community = new SteamCommunity(steamClient); var friends = new Steam.SteamFriends(client.client); I know, it is kind of a mess, but it works! However, I know that the 'community' and 'friends' handlers are also present in your node-steam-user library. But how do I access them? 'client.friends' or 'client.community' doesn't work anymore. Furthermore, I initiated steamUser = new Steam.SteamUser(steamClient), but I only use it for the following: // Decline friend requests when we get back online friends.on("relationships", function(){ for (steamID in friends.friends) { if (friends.friends[steamID] === SteamUser.Steam.EFriendRelationship.RequestRecipient) { friends.removeFriend(steamID); console.log("Friend request while offline from: " + steamID); } } }); // Decline friend requests when we are online friends.on("friend", function (steamID, relationship) { if (relationship == SteamUser.Steam.EFriendRelationship.RequestRecipient) { friends.removeFriend(steamID); console.log("Friend added"); } }); How can I make sure to only use the EFriendRelationship from your node-steam-user library? These questions are really basic, but your help would as always be really appreciated, because then I can take seishun's node-steam library out of the equation and just continue my project with your steam-user library.
  15. For the people who would like to know how I implemented this. friends.on("friendMsg", function(steamID, msg, type) { client.getPersonas([steamID], function(personas) { var persona = personas[steamID]; var name = persona ? persona.player_name : ("[" + steamID + "]"); if (type == Steam.EChatEntryType.ChatMsg) { console.log("Friend message from " + name + ": " + msg); if (msg == "Ping") { friends.sendMessage(steamID, "Pong"); console.log("Send back: Pong"); } else { friends.sendMessage(steamID, config.greetMsg); console.log("Send back the standard reply"); } } }); }); I did not use .getSteamID64, because it gave me an error. I don't really know to which library that method belongs, so I left it out, since steamID was already in the 64-format.
×
×
  • Create New...