Jump to content
McKay Development

Can someone help me with comment on users profile?


codingcore

Recommended Posts

Hey ^^

 

So about 1 week ago I started to develop my first SteamBot ever in Node.JS

var Steam = require("steam");
var SteamUser = require ("steam-user");
var client = new SteamUser();

var friends = new Steam.SteamFriends(client.client);

var SteamCommunity = require('steamcommunity');
var community = new SteamCommunity();

var client;

var SteamID = require("steamid");


client.logOn({
   "accountName": "",
   "password": ""
 });

client.on('loggedOn', () => {
	
	console.log('Logged in! Bot is now logged into your account!');

	client.gamesPlayed('730');
	
});

client.on('friendRelationship', function(sid, relationship) {
    if(relationship == 2) {
        client.addFriend(sid);
        console.log("BOT #1: Added a new friend!");
		client.chatMessage(sid, 'Hello! Thank your for adding me as a friend ^^ - This is an automatically generated message by astaribot#1');
community.postUserComment(sid, '+rep good mate');
    }
});

And now I dont know how I can do it that the Bot writes and comment on the users profile after accepting the friend request :/

Link to comment
Share on other sites

Instead of comparing relationship to a number directly, you should compare to SteamUser.EFriendRelationship.RequestRecipient.

 

You're firing off the addFriend request but then immediately trying to send a chat message and post a comment. Steam sees this as all happening at the same time, and wouldn't have processed your add-friend request when you try to post the comment. You need to wait for friendRelationship to get emitted again, this time with relationship Friend.

Link to comment
Share on other sites

  • 2 weeks later...

this worked for me as said by dr mckay

 

client.on('friendRelationship', (friend, relationship) => {
if(relationship == SteamUser.EFriendRelationship.RequestRecipient) {
client.addFriend(friend);
message(friend, "Thanks for adding me, use !help to get started.");
community.postUserComment(friend,"Thanks for adding! Enjoy your stay and have a good Day!");


}});
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...