Search the Community
Showing results for tags 'node-steam-user'.
-
So I am using steam-user to get a list of gameservers. My code worked for a while but when I tried to do it again on another script it just returns "null". I have tried everything I can think of and I am out of ideas. Anything to point me in the right direction would be greatly appreciated. const SteamUser = require('steam-user'); const client = new SteamUser(); client.logOn(); client.on('loggedOn', () => { console.log('Logged into Steam'); client.getServerList(null, 100, (servers) => { console.log(servers); }) });
-
Hello logOn method not working. Stucked on "751" I try debugging and my logs =>
-
Hello, I just started building my steam level up bot and couldn't code it when someone adding him to tell 'Hello, "Persona Name" Thank you for adding me'. this is the code i put it from another question but its sending 'Hello, [steamID] Thank you for adding me'. client.getPersonas([steamID], function(personas) { var persona = personas[steamID.getSteamID64()]; var name = persona ? persona.player_name : ("[" + steamID.getSteamID64() + "]"); }); client.chatMessage(steamID, 'Hi ' + name + ' Thank you for adding me!'); } });
-
Hey, iam work on new functions for my BOT. I am currently working on boosting my main account via chat message to my BOT. The login works fine, but the logout does not work and I can't find the error Here my Code: // Boost Owners Account START else if (MSG.toUpperCase().indexOf("!STARTBOOST") >= 0) { let BoostClient = new SteamUser(), BoostManager = new TradeOfferManager({ "steam": BoostClient, "pollInterval": "10000", "cancelTime": "1800000" // 30m in ms }), BoostCommunity = new SteamCommunity(); let BoostLogOnOptions = { accountName: CONFIG.Boost.USERNAME, password: CONFIG.Boost.PASSWORD, twoFactorCode: SteamTotp.generateAuthCode(CONFIG.Boost.SHAREDSECRET) }; BoostClient.logOn(BoostLogOnOptions); BoostClient.on("loggedOn", function() { BoostClient.getPersonas([BoostClient.steamID], (personas) => { sleep(500); console.log("[Boost Steam Account] - Login successfully!"); client.chatMessage(SENDER, "[Boost Steam Account] - Login successfully!"); BoostClient.setPersona(SteamUser.Steam.EPersonaState.Online); BoostClient.gamesPlayed(730); }); }); BoostClient.on('webSession', (sessionid, cookies) => { BoostManager.setCookies(cookies); BoostCommunity.setCookies(cookies); sleep(2000); console.log("[Boost Steam Account] - Cookies set successfully"); client.chatMessage(SENDER, "[Boost Steam Account] - Cookies set successfully"); }); sleep(7000); console.log("[Boost Steam Account] - Boosting Games Active"); client.chatMessage(SENDER, "[Boost Steam Account] - Start Boosting Games"); } else if (MSG.toUpperCase().indexOf("!STOPBOOST") >= 0) { let BoostClient = new SteamUser(); BoostClient.logOff(); sleep(1000); console.log("[Boost Steam Account] - Stop Boosting Games"); client.chatMessage(SENDER, "[Boost Steam Account] - Stop Boosting Games"); } // Boost Owners Account END It runs not in an error, but i dont log off :-((( I hope someone can help me out... THX
-
Hi, I have a few questions: 1. How can i get RegionID of my account (that using in Steam Store). Reffering to this https://i.gyazo.com/93754ec9ef0032dbe38ce466b6d86974.png (is it right place?), my code is '62' but i want a country string like 'RU' or 'US'? Couldn't find any info in enums for that. 2. Is it possible to buy/buyAsGift games in Steam Store on US account from different GeoIP? Which pool of regions would be supported for gifting (GeoIP regions or account regions)? 3. And maybe somewhere exists a method to get that pool of supported regions for certain account (for buying games as gifts)? 4. Can i somehow catch an event when a recipient accept/decline a gift (from Steam Store, not from inventory)?
-
I would like it to accept everyone who added me when the bot wasn't opened. i've tried to do that but i think i didn't get how it works, here's what i tried: client.on('loggedOn', () => { client.setPersona(1); client.getPersonas(client.myFriends); }); client.on('user', function (sid, user) { console.log(sid + " " + user.value); if (user.value == 2) { client.addFriend(sid); client.getChatHistory(sid); } });
-
1. Is there a way to invite people to a steam lobby? (not chat one). the one that emits the 'lobbyInvite' ID event... 2. the 'friendOrChatMessage' ID event emit also when i write a message in a chat. how can i detect whether it is me or not, because the senderID isn't my id even if i write the message (in dm's only). the senderID it is the friend whom i wrote to... (maybe it's a bug so idk). 3. Is there any way to wait for a user input in the console while executing other functions that run on the same js file?
-
How can i loop the sender message, so that i can wait for the response of the option to be selected which was printed by the for loop Kindly View the Attached Images for an clear example: Image of the example client.on("friendMessage", (SENDER, MSG) => { ... ... else{ var countList = 1; for(var i = 0; i < listOfProducts.length; ++i){ if(listOfProducts[i].is_free_license == false){ client.chatMessage(SENDER, countList +". "+listOfProducts[i].option_text) ountList++; } else{ client.chatMessage(SENDER, result[0].name + ", Unfortunately you can not buy this game as a gift.") } } console.log(countList); client.on("friendMessage", (SENDER, MSG) => { countList = countList - 1; if (MSG === 1) { client.chatMessage(" has been added to the Cart.") } }); } ... ... }); Kindly drop your suggestions... and thank you for your precious time.
-
Hello. I just updated npm modules and got steam-user 4.5 and my bot is still running fine (AFAIK). Is there a place where I can read about important changes made in v4.X which break v3.X code? I saw the announcements page here and releases on github but there's too many, so I was looking for some "shortcut" reading. Thanks
-
sorry to whine, but I am suffering from a memory leak issue with the version 4 branch. After disabling all my code, except for one account logging in, (and doing nothing) it still leaks. I left the one idle account running doing nothing and after about a day or so it exceeded the ~1.5 GB of heap the node process (by default) can use. I then downgraded to 3.9.2 and it's fine now. I restored all the code and all the accounts are running and its been 12 hours now and memory usage is proper and garbage collecting is happening. It kinda seems like garbage collecting wasnt happening with v4, but I'm not sure exactly, as I didn't play around much with --expose-gc, yet. I quick glance suggested I couldnt just hack around this with manual global.gc() calls, but that would have probably been fine with me. This happens on Linux and Windows, and im using node lts 10, linux from now on. What version does the the doctor use, btw? I wish could be of more help, I tried generating heapdumps, but It locked up my machine, and I cant seem to get 'node-memwatch' installed/compiled, which had some event I maybe later could listen to that detects leaks. All the accounts are 'assigned/joined/ to a steam group chat however, a idle ghost town chat with nobody chatting in there, so maybe its likething related to (other) group chat events. Ill try to test this out next with an account who is not joined to a group chat. thanks for looking.
-
Hi, im new to this and i don't know how to check if the key is valid or invalid.. This is the code client.on("friendMessage", function (steamID, message) { if (steamID == AdminID && message.indexOf('!key') == 0) { var GetKey = message.replace('!key ', ''); client.redeemKey(GetKey); client.chatMessage(steamID, "Key activated: " + GetKey); } }); Thanks
-
[REDACTED]
-
So I'm using getUserInventoryContents for someone who uses my bot to check his inventory and see if I have items that my bot accepts. https://pastebin.com/sXYvkTMD All works out but it does not give all the items results than it should. For example, I have 6 SF arcanas but it only tells me 4. Also what may be the reason why I get "TypeError: Cannot read property 'EPersonaState' of undefined" in my linux and in my windows it works perfectly fine.
-
So just trying to figure out if I'm dumb or if something is up. I'm updating my bot manager and since update doesn't use steam-client anymore I can't use .bind() which was working. See my attached image. Basically client is still returning my own localhost IP. Not the proxy one I'm setting.
- 5 replies
-
- node.js
- node-steam-user
-
(and 2 more)
Tagged with:
-
So I planned to write a script for the bot to have a background check. const SteamUser = require('steam-user'); var client = new SteamUser(); var steamid = '76561198302774496'; client.getSteamLevels([steamid], function(results){ console.log(results); }) However, it didn't show the results to the console.
-
How do you get rich presence data? Through Steam Web Api? Im using GetPlayerSummaries but this endpoint didnt return rich presence data
-
Apps in getproductinfo is returning null but not when I try to access from package. Is something wrong? Is it because I download the dependencies using npm?
-
Hi. I'm migrating from v3 to v4, and trying to redeem Steam key. I added err argument as described in release notes, and now have the following code: client.redeemKey(key, (err, detail, packages) => { if (err) { console.log('Can not redeem: ' + SteamUser.EPurchaseResultDetail[detail]); return; } console.log('Redeemed!'); }); If key can not be redeemed, in v3 I get detailed reason, for example DoesNotOwnRequiredApp. But in v4 detail argument seems to be undefined. How can I access this info now, after migration to v4? Thanks
-
Hi, how can i get full chat history like in as steam chat ? When I using client.getChatHistory() I getting less messages than in steam chat in web browser, and after several times using this method - history would clear. Can you add the method like in steam web chat for getting full history ? through websocket method or smth
-
I wrote an application that idles all of my games to x amount of minutes. My problem is that after logging in and passing some appIds to gamesPlayed, I am being prompted to enter my Steam Guard code after a while. I have had it run fine for over 30 minutes sometimes before being asked, but it's usually within 5-10 minutes. I'm listening to both sessionExpired and error, but it doesn't seem to be either of them. The goal is to log on just once and have it idle games until the application is closed. I call webLogOn every 15 minutes, but that doesn't seem to be the problem, as I'm usually prompted before that. I've also tried assigning the loginKey to my log in options after first logging in, which supposedly omits the need for a guard code, but that doesn't work either. Why is this happening? Any help would be greatly appreciated. Code: global._mckay_statistics_opt_out = true; const SteamClient = require('steam-user'); const SteamCommunity = require('steamcommunity'); const community = new SteamCommunity(); const client = new SteamClient(); let apiKey = (''); const minutesToIdle = 180; let gamesToIdle = []; let gamesTimePlayed = []; let appNames; let steamID; const logInOptions = { accountName: '', password: '', logonID: Date.now(), rememberPassword: true }; // Initialize (function () { console.log('Loading game names...') community.request('some api', (error, response, data) => { if (!error && response.statusCode == 200) { appNames = JSON.parse(data).data; client.logOn(logInOptions); } else { console.log('Failed to get game names, listing AppIDs instead.') setTimeout(function() { client.logOn(logInOptions); }, 4000); } }) })() client.on("webSession", (sessionID, cookies) => { console.clear(); console.log("Got web session"); community.setCookies(cookies); getGamesInfo(); }); // Get owned games and time information. function getGamesInfo () { gamesToIdle.length = 0; gamesTimePlayed.length = 0; console.log('\x1b[36m%s\x1b[0m', 'Idle all Steam games'); community.request('https://api.steampowered.com/IPlayerService/GetOwnedGames/v0001/?key=' + apiKey + '&steamid=' + steamID, (error, response, data) => { if (!error && response.statusCode == 200) { const gamesData = JSON.parse(data); const gamesTotal = gamesData.response.game_count; console.log('\x1b[32m%s\x1b[0m', '\nAmount of games: ' + gamesTotal); // Check playtime for past 2 weeks and forever. for (var i = 0; i < gamesTotal; i++) { if (gamesData.response.games[i].playtime_forever < minutesToIdle) { if (gamesData.response.games[i].playtime_2weeks == null || gamesData.response.games[i].playtime_2weeks < minutesToIdle) { gamesToIdle.push(gamesData.response.games[i].appid); gamesTimePlayed.push(getMostTime(gamesData.response.games[i].playtime_forever, gamesData.response.games[i].playtime_2weeks)); } } } if (gamesToIdle.length > 1 ) { console.log('\x1b[32m%s\x1b[0m', 'Games left to idle: ' + gamesToIdle.length); assignAppNames(); } else { console.log('Done idling.') } } else { console.log('Error loading games, retrying in 1 minute...'); setTimeout(function() { client.webLogOn(); }, 600000); } }) } // Returns most time played between last 2 weeks and forever. function getMostTime (a, { if (a > { return a; } else { return b; } } // Assigns app names to display, or appIDs if none found. function assignAppNames () { let gameNames = []; for (var i = 0; i < 29 && i < gamesToIdle.length; i++) { if (appNames != null && appNames.hasOwnProperty(gamesToIdle[i])) { gameNames.push(appNames[gamesToIdle[i]]); } else { gameNames.push(gamesToIdle[i]); } } idleGames(gameNames); } // Idle the games. function idleGames (gameNames) { let idleNow = []; for (var i = 0; i < 29 && idleNow.length < gamesToIdle.length; i++) { idleNow.push(gamesToIdle[i]); } client.gamesPlayed(idleNow); console.log('\x1b[32m%s\x1b[0m', 'Now idling: ' + idleNow.length + '\n') gameNames.forEach(function(element) { console.log(element + '\x1b[33m%s\x1b[0m', ' [' + (gamesTimePlayed[gameNames.indexOf(element)] / 60).toFixed(2) + ']'); }) console.log('\n' + 'Last update: ' + '\x1b[33m%s\x1b[0m', getDateTime()); setTimeout(function() { client.webLogOn(); }, 900000); } community.on("sessionExpired", error => { console.log("Steam web session expired: " + error.message); if (client.steamID) { client.webLogOn(); } else { client.logInOptions.logonID = Date.now(); client.logOn(logInOptions); } }); client.on("error", error => { console.log("An error has occurred: " + error.message); } ); client.on('loggedOn', (details) => { console.log('Logged on Steam.'); client.setPersona(SteamClient.EPersonaState.Invisible); steamID = details.client_supplied_steamid; }); function getDateTime() { var date = new Date(); var hour = date.getHours(); hour = (hour < 10 ? "0" : "") + hour; var min = date.getMinutes(); min = (min < 10 ? "0" : "") + min; var sec = date.getSeconds(); sec = (sec < 10 ? "0" : "") + sec; var year = date.getFullYear(); var month = date.getMonth() + 1; month = (month < 10 ? "0" : "") + month; var day = date.getDate(); day = (day < 10 ? "0" : "") + day; return hour + ":" + min + ":" + sec; }
-
Hello With new steam chat we get a trade notification chat message together with any incoming offer from a friend: https://i.imgur.com/PV4TgEu.jpg My problem is that when I'm using this code: //Chat Messages Check //This will fire when we receive a chat message from ANY friend client.on('friendMessage', function(steamID, message) { client.getPersonas([steamID], function (personas) { console.log('Friend message from ' + personas[steamID]["player_name"] + ': ' + message); }); }); Bot's notifications aren't cleared (there is one for every trade offer); so my question is, there's a way to keep that code and clear trade notifications altogether (maybe something which fires after a trade is received)? Thanks
-
Hi, Currently I'm using v3 version: const Steam = require('steam-client'); const SteamUser = require('steam-user'); const SteamCommunity = require('steamcommunity'); const TradeOfferManager = require('steam-tradeoffer-manager'); let client = new Steam.CMClient(); client.setHttpProxy(proxyUrl); let user = new SteamUser(client, { debug: true, singleSentryfile: false, autoRelogin: true, dataDirectory: '/files/clients' }); let community = new SteamCommunity(); let manager = new TradeOfferManager({ steam: user, community: community }); And in v4 I should change to: const SteamUser = require('steam-user'); const SteamCommunity = require('steamcommunity'); const TradeOfferManager = require('steam-tradeoffer-manager'); let user = new SteamUser({ debug: true, singleSentryfile: false, autoRelogin: true, dataDirectory: '/files/clients' }); user.setHttpProxy(proxyUrl); let community = new SteamCommunity(); let manager = new TradeOfferManager({ steam: user, community: community }); Can you advice please? NOTE: so v4 node-user replaces steam-client?
-
You know, I've been trying to find out whether or not this is allowed and every time I ask Valve they refuse to answer. They deliberately say they can not answer. There was someone who tried to explain how to use this script to change your name yellow, but I didn't quite understand really. I'm not a coder really and all I was looking for is a way to change my name yellow in a simple safe way. I don't even know what this tool of yours does or how to run it even. But I am hoping you might be able to shed some light on whether or not Steam till ban people for using it to make their names yellow/gold. If it is allowed, is there a simple thing I can just run once to set my state? I have no idea what this thing is or does. Just an average user looking to set their name to gold using the "PersonaStateFlags" #4.
-
how exactly does one send chat messages to a broadcast? do they function like group chats?
-
So I planned to write a script for the bot to have a background check. Is there a way using steam-user to find out specific user game time? (say like TF2). If so, what is the method? Thanks