Jump to content
McKay Development

Trying to get personaName from SteamID


metzz

Recommended Posts

[ALREADY FIXED, PLEASE DELETE THIS POST.]

Hello, im starting to learn nodejs and I have a problem if you could help me would be amazing!

So I made this Steam Bot, which IDLE's a game and receives, responds to steam messages.

But im trying to log everything in my console, like who sent me the message and whats the content of it.

Ive searched for and found another guy who had this problem but for me it didnt fix it, this is my code:

client.on("friendMessage", function(steamID, message) {
    client.getPersonas([steamID], function (personas) {
        const persona = personas[steamID.getSteamID64()];
        const name = persona ? persona.player_name : (steamID.getSteamID64());

    if (message != 'null') {
        client.chatMessage(steamID, config.mensagemAutomatica);
        console.log("Message received:", message,"||", "From:", name);
    }
   
 })
});

So whenever someone sends me a message, im getting the following error:

const persona = personas[steamID.getSteamID64()];
                                ^

TypeError: Cannot read property '76561198171125906' of null
    at C:\Users\Administrator\Desktop\coding\steam-bot\bot.js:42:33
    at Immediate.<anonymous> (C:\Users\Administrator\Desktop\coding\steam-bot\node_modules\@doctormckay\stdlib\components\promises.js:24:6)
    at processImmediate (internal/timers.js:439:21)

Id appreciate any help!

Edited by metzz
Link to comment
Share on other sites

  • 1 year later...

Hi, I'm new, where can I find the documentation? I have error in "var persona = personas[steamID.getSteamID64()];
                                                                                                                                                    ^

in   [

Link to comment
Share on other sites

2 hours ago, NoiseBaphomet said:

Hi, I'm new, where can I find the documentation? I have error in "var persona = personas[steamID.getSteamID64()];
                                                                                                                                                    ^

in   [

The documentation is on GitHub. I would need to see the entire error output to help you with that at all.

Link to comment
Share on other sites

D:\bot\bot.js:75
    var persona = personas[steamID.getSteamID64()];
                                           ^

TypeError: Cannot read property '76561198987247955' of null
    at D:\bot\bot.js:75:27
    at Immediate.<anonymous> (D:\bot\node_modules\steam-user\node_modules\@doctormckay\stdlib\components\promises.js:90:6)
    at processImmediate (internal/timers.js:461:21)

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...