TheGoldenPotato Posted August 25, 2017 Report Posted August 25, 2017 (edited) Hello, I am trying to make my bot say people's names, and then a welcome message. But currently with the code that I got, it only says "NaN Hello, I am a generous Trading Bot, I would love to trade with you, but I am currently in maintenance mode. Check back later.". I do not know why it says NaN, instead of the user's name. My current code looks like this client.on("friendRelationship", (SENDER, REL) => { client.getPersonas([client.steamID], (personas) => { if (REL === 2) { client.addFriend(SENDER); } else if (REL === 3) { if (CONFIG.INVITETOGROUPID) { client.inviteToGroup(SENDER, CONFIG.INVITETOGROUPID); } client.chatMessage(SENDER, + personas + CONFIG.MESSAGES.WELCOME); } }); }); Edited August 31, 2017 by TheGoldenPotato Quote
Axle Posted August 26, 2017 Report Posted August 26, 2017 Because you want to get their data you should do client.getPersonas([sENDER]), client.steamID is your own steamID. The other thing is that personas is an object, not just their names because it getPersonas can handle multiple steamIDs. I don't remember how the object is exactly setup. This should help in more detail:https://dev.doctormckay.com/topic/660-how-to-go-from-steam64-to-steam-username-the-name-currently-used-on-steam/ Quote
TheGoldenPotato Posted August 26, 2017 Author Report Posted August 26, 2017 (edited) Because you want to get their data you should do client.getPersonas([sENDER]), client.steamID is your own steamID. The other thing is that personas is an object, not just their names because it getPersonas can handle multiple steamIDs. I don't remember how the object is exactly setup. This should help in more detail:https://dev.doctormckay.com/topic/660-how-to-go-from-steam64-to-steam-username-the-name-currently-used-on-steam/ But when I tried the solution which was posted in that thread, it still says NaN in the message. My code looks like this now. client.on("friendRelationship", (SENDER, REL) => { client.getPersonas([SENDER], function(personas) { var persona = personas[SENDER.getSteamID64]; var name = persona ? persona.player_name : ("[" + SENDER.getSteamID64 + "]"); if (REL === 2) { client.addFriend(SENDER); } else if (REL === 3) { if (CONFIG.INVITETOGROUPID) { client.inviteToGroup(SENDER, CONFIG.INVITETOGROUPID); } client.chatMessage(SENDER, + name + CONFIG.MESSAGES.WELCOME); } }); }); Edited August 26, 2017 by TheGoldenPotato 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.