Jump to content


Photo

Can someone help me with comment on users profile?


  • Please log in to reply
2 replies to this topic

#1 codingcore

codingcore

    Newbie

  • Member
  • Pip
  • 1 posts

Posted 17 December 2018 - 06:01 AM

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 :/



#2 Dr. McKay

Dr. McKay

    Developer

  • Administrator
  • 1,879 posts

Posted 18 December 2018 - 05:03 PM

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.



#3 Riya

Riya

    Newbie

  • Member
  • Pip
  • 6 posts

Posted 28 December 2018 - 12:30 AM

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


}});





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users