mrlon Posted February 18, 2019 Report Posted February 18, 2019 HI, I wanna try to edit my profile name function setupProfile(username) { community.editProfile({ 'name' : username, }, function(err) { if (err) { console.log('Failed to Edit Profile'); console.log(err); } }); } but I got this error Failed to Edit Profile Error: Not Logged In at SteamCommunity._checkHttpError (E:\new\steambot\node_modules\steamcommunity\components\http.js:95:9) at Request._callback (E:\new\steambot\node_modules\steamcommunity\components\http.js:50:61) at Request.self.callback (E:\new\steambot\node_modules\request\request.js:185:22) at Request.emit (events.js:182:13) at Request.<anonymous> (E:\new\steambot\node_modules\request\request.js:1161:10) at Request.emit (events.js:182:13) at Gunzip.<anonymous> (E:\new\steambot\node_modules\request\request.js:1083:12) at Object.onceWrapper (events.js:273:13) at Gunzip.emit (events.js:187:15) at endReadableNT (_stream_readable.js:1094:12) as you can see that give me error Not Logged In but u can see my screenshot I already login to account,please help Quote
Dr. McKay Posted February 19, 2019 Report Posted February 19, 2019 I'm not sure whether this would cause the issue you're describing or not, but is your Steam profile set up yet? I only ask due to the name of your function. Quote
mrlon Posted February 19, 2019 Author Report Posted February 19, 2019 I already do manual setup to my profile name, I already try everything like realName,summary,country,state,city,customURL,background get same error, Error: Not Logged Iuser.on('loggedOn', () => {user.setPersona(SteamUser.EPersonaState.Online);console.log("Logged on!");user.gamesPlayed(730);user.emit("friendsList");setupProfile("newname"); }); Quote
Dr. McKay Posted February 19, 2019 Report Posted February 19, 2019 You aren't logged into Steam Community until webSession fires. Quote
mrlon Posted February 19, 2019 Author Report Posted February 19, 2019 so i need to putsetupProfile("newname");insideuser.on('webSession', (sessionid, cookies) => {community.setCookies(cookies);setupProfile("newname");}); ?but I get error cookies.forEach((cookie) => { ^TypeError: Cannot read property 'forEach' of undefined so how to make im loggedon comunity? Quote
Dr. McKay Posted February 20, 2019 Report Posted February 20, 2019 That code looks correct. You're obviously doing something else wrong, but I can't tell you what without seeing more code (and a full stack trace). Quote
mrlon Posted February 20, 2019 Author Report Posted February 20, 2019 here my full code var username;var password;var Steam = require("steam");var steamCode;var SteamCommunity = require('steamcommunity');var community = new SteamCommunity();var fs = require("fs");var SteamUser = require('steam-user');var readline = require("readline");var LineByLineReader = require('line-by-line'),var user = new SteamUser();var rl = readline.createInterface({input: process.stdin,output: process.stdout}); user.on('steamGuard', function(domain, callback) {console.log("oops we need steam guard"); rl.resume();rl.question("enter SteamGuard code: ", function(answer) { steamCode = answer; rl.pause(); callback(steamCode);});});user.on('webSession', (sessionid, cookies) => {community.setCookies(cookies);/*got error E:\new\steambot\node_modules\steamcommunity\index.js:296 cookies.forEach((cookie) => { ^TypeError: Cannot read property 'forEach' of undefined*/setupProfile("its a name");//got Error: Not Logged In at SteamCommunity._checkHttpError (E:\new\steambot\node_modules\steamcommunity\components\http.js:95:9)});user.on('loggedOn', () => {user.setPersona(SteamUser.EPersonaState.Online);console.log("Logged on!");user.gamesPlayed(730);user.emit("friendsList");user.emit("webSession"); });user.on("friendsList", function() {for (var steamid64 in user.myFriends) {var relationship = user.myFriends[steamid64];if (relationship == SteamUser.EFriendRelationship.RequestRecipient) {addFriend(steamid64);console.log("we just add frind" + steamid64); }}});function addFriend(steamID){user.addFriend(steamID);}function setupProfile(username) {community.editProfile({'name' : username,}, function(err) {if (err) {console.log('Failed to Edit Profile');console.log(err);}});} Quote
Dr. McKay Posted February 20, 2019 Report Posted February 20, 2019 user.emit("friendsList");user.emit("webSession"); MrPotato 1 Quote
mrlon Posted February 20, 2019 Author Report Posted February 20, 2019 what wrong with that? sry I really dont know,its work fine for adding friend when login Quote
Dr. McKay Posted February 20, 2019 Report Posted February 20, 2019 You should never call emit on a SteamUser instance yourself. Events are emitted by the module. Quote
creditc0dee Posted March 4, 2019 Report Posted March 4, 2019 Code is fine, but for a reason the whole profile gets set back again. So is there a better way then this one? Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.