Jump to content
McKay Development

justarandomdeveloper

Member
  • Posts

    3
  • Joined

  • Last visited

Recent Profile Visitors

397 profile views

justarandomdeveloper's Achievements

  1. Hey @Vanilla. Solved it with getSteamUser Thanks for the help. Here's my code if anyone wants to reference it in the future: checkFriendsAndMessagesWhileOffline() {this.client.on('friendsList', () => {let friendcount = 0;Object.keys(this.client.myFriends).forEach(steamId => {if (this.client.myFriends[steamId] === SteamUser.Steam.EFriendRelationship.RequestRecipient) {logger.info(`Friend request while offline from: ${steamId}`);this.community.getSteamUser(steamId, (err, user) => { if (err) {return logger.error(`Cannot get user: ${err}`)} if (user && (user.privacyState == "private" || user.privacyState == "friendsonly")) {return logger.warn(`User ${user.name} is private. Aborting...`);} logger.debug(`Profile is not private. Adding...`)this.client.addFriend(steamId, (err, name) => {if (err) {return logger.error(`Cannot add friend: ${err}`)}logger.info(`Added ${name} as a friend.`);});this.client.chatMessage(steamId, `Thanks for adding! Type '!help' for commands.`);});};});}); this.client.on('offlineMessages', (count, friends) => {logger.info(`${count} messages from ${friends} since your last login.`)});};
  2. Hey, so I have this function, as follows: checkFriendsAndMessagesWhileOffline() {this.client.on('friendsList', () => {let friendcount = 0;Object.keys(this.client.myFriends).forEach(steamId => {if (this.client.myFriends[steamId] === SteamUser.Steam.EFriendRelationship.RequestRecipient) {logger.info(`Friend request while offline from: ${steamId}`); this.client.addFriend(steamId, (err, name) => {if (err) {return logger.error(`Cannot add friend: ${err}`)}logger.info(`Added ${name} as a friend.`);});this.client.chatMessage(steamId, `Thanks for adding me! Type '!help' for commands.`);};});}); this.client.on('offlineMessages', (count, friends) => {logger.info(`${count} messages from ${friends} since your last login.`)});}; Now, above line 5 I want to do something like (pseudo-code) if (this.client.myFriends[steamId] == steamid.isPrivate) { declineFriendship(); } Is there any way to achieve this? Couldn't find anything in the wiki / docs. Many thanks and thanks for all the hard work that went into this project.
  3. Hi everyone, have this nodejs backend which is calling the Steam api via passport-steam to log a user in. This is working and in this code I am getting the user back. app.get( //regex to validate auth/steam/ and auth/steam/return /^\/auth\/steam(\/return)?$/, passport.authenticate('steam', { failureRedirect: '/' }), (req, res) => { console.dir(req.user); res.redirect('/account'); } );So I have user as req.user in the callback after the Steam Login passes. My question is: What is the best (AND MOST SECURE!) way to pass this req.user to a route, which I will then call GET from the Frontend Framework so I can get this data to the Frontend? Furthermore, how does my Frontend communicate with my nodejs bot in a secure manner? (maybe this is a broad question but worht a try!) Right now I have this route set up: app.get('/account', (req, res) => { res.send({user: req.user}); });But user is null. Any help is appreciated!
×
×
  • Create New...