Jump to content
McKay Development

getPersonas 'Persona Name'


THR

Recommended Posts

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!');
  }
  });
Link to comment
Share on other sites

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);
    }
Link to comment
Share on other sites

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 by THR
Link to comment
Share on other sites

  • 4 weeks later...

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!"

);

});

 

}

});

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...