Jump to content
McKay Development

How to get your own name in console (and other users (optional))


Recommended Posts

Hey, I started using Node.js and javascript a short time ago.


I was trying to display my own username in console after logon. And if that worked, I'd try for others.

I was hoping if you could help me.


This is my code: 

client.on('loggedOn', function() {
    console.log("[Steam-BOT] Logged in as " + client.steamID);
    var botSteamID = [client.steamID];

    var clientName = client.getPersonas(botSteamID);

So I thought this was the way to go but, clientName stays unidentified. 


I do not know what I am doing wrong


Thanks in advance!

Link to comment
Share on other sites

After some time having trouble with it (as I am new), I got it to work! Thanks so much dude! for everyone else wondering.. I used this:

client.on('friendMessage', function(steamID, message) {		
    friendID = [steamID];
    client.getPersonas(friendID, function(getName) {
        var x = getName[friendID];
        var friendName = x.player_name;

        console.log("[FriendlyMessage] " + friendName + ": " + message);

Brackets could be wrong because my code didn't stop there and I am correcting it within the text editor


I do have another question and I don't know if I should ask it here?

But, what are the numbers for friendrelationships??

I know 2 is friend request send to me. But where can I find it.. because I am having trouble finding everything...  :mellow:  :mellow:


EDIT: After actually turning my brain on.. I checked within the files of your node and found a file with the numbers.... Shit I'm stupid... Thanks anyway!! GREAT SHIT DUDE!!!

Edited by MrKirby
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.

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.

  • Create New...