codingcore Posted December 17, 2018 Report Posted December 17, 2018 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 :/ Quote
Dr. McKay Posted December 18, 2018 Report Posted December 18, 2018 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. Quote
Riya Posted December 28, 2018 Report Posted December 28, 2018 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!"); }}); Quote
Recommended Posts
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.