THR Posted March 7, 2019 Report Share Posted March 7, 2019 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!'); } }); Quote Link to comment Share on other sites More sharing options...
Dr. McKay Posted March 7, 2019 Report Share Posted March 7, 2019 What version of steam-user are you using? Quote Link to comment Share on other sites More sharing options...
THR Posted March 8, 2019 Author Report Share Posted March 8, 2019 (edited) [email protected] i get the information from the package.json.Now i change it to 4.5 but the same it sending the SteamID not the the name. Edited March 8, 2019 by THR Quote Link to comment Share on other sites More sharing options...
Dr. McKay Posted March 9, 2019 Report Share Posted March 9, 2019 Please read the v4 release notes. The first argument to callbacks is now err. Quote Link to comment Share on other sites More sharing options...
THR Posted March 9, 2019 Author Report Share Posted March 9, 2019 Can you tell me how to callback the err,please ? Quote Link to comment Share on other sites More sharing options...
THR Posted March 9, 2019 Author Report Share Posted March 9, 2019 OK sir it worked and this is the code.Please tell me if there is any mistake and thank you. client.getPersonas([steamID], function(err, personas) { if (err) {console.log('error.')} else { persona = personas[steamID.getSteamID64()]; name = persona ? persona.player_name : ("[" + steamID.getSteamID64() + "]"); client.chatMessage(steamID,'The name is ' + name); } Quote Link to comment Share on other sites More sharing options...
Dr. McKay Posted March 10, 2019 Report Share Posted March 10, 2019 Yep, that looks correct. I'm pretty curious as to how you weren't crashing with the old code, but as long as that works, all's well that ends well. Quote Link to comment Share on other sites More sharing options...
THR Posted March 10, 2019 Author Report Share Posted March 10, 2019 (edited) Thank you anyway sir. I just wanted to ask you about steamcommunity postUserComment here is the code : client.on('friendRelationship', (steamID, relationship) => {if (relationship === SteamUser.EFriendRelationship.RequestRecipient) { client.addFriend(steamID); client.inviteToGroup(steamID, config.groupid, ); community.postUserComment(steamID, "Thanks for adding me ! I wish you good day."); it is doing nothing, can you tell me how to callback ??Please help me it's not working Edited March 11, 2019 by THR Quote Link to comment Share on other sites More sharing options...
Dr. McKay Posted March 11, 2019 Report Share Posted March 11, 2019 You might need to wait for friendRelationship to get emitted again with relationship SteamUser.EFriendRelationship.Friend. But a lot of people are having issues automatically posting comments; Valve might have put some anti-spam measures into place. Quote Link to comment Share on other sites More sharing options...
CellSplitter Posted April 4, 2019 Report Share Posted April 4, 2019 You can do this for example: client.on('friendRelationship', function(steamID, relationship) { if (relationship == SteamUser.Steam.EFriendRelationship.RequestRecipient) { client.addFriend(steamID); console.log(" "); console.log("Accepted friend request from: " + steamID); var name; client.getPersonas([steamID], function(personas) { var persona = personas[steamID]; name = persona ? persona.player_name : ("[" + steamID + "]"); client.chatMessage(steamID, "\nWelcome " + name + " !!!" + "\nI am a +REP BOT and i can give you a +REP Comment on your Steam® Profile" + "\nType !help in Chat to get started!" ); }); }}); Quote Link to comment Share on other sites More sharing options...
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.