Jump to content
McKay Development

Add random people


NULL;

Recommended Posts

Hello everyone!

So I've been working on a bot that will invite people to a steam group when they accept the friend request, my following question for this is if it's possible to add random people.
For an example: One person adds the bot, then we add all their friends from their friendlist and so that cycle goes on.

If you got any ideas then please hit me up. I'll also import my code below.

// DEFINES
const SteamUser = require('steam-user');
const config = require('./config.json');
const client = new SteamUser();

// CONFIGS
var message = "Hello, would you like to be kind and join my steam group? :)";
var messageNoReply = "Sorry, but this account is a bot. We can't answer you :(";
var delay = 2000;

// LOGIN
const accountInfo = {
	accountName: config.accountName,
	password: config.password
};

client.logOn(accountInfo);

client.on('loggedOn', function(details) {
    console.log("Logged into steam successfully!");
    client.setPersona(SteamUser.EPersonaState.Online);
});

// REQUEST MANAGER
client.on('friendRelationship', (steamid, relationship) => {
	if (relationship === 2) {
		// ACCEPT PENDING ERQUESTS
		console.log("Accepted friendrequest from: " + steamid);
		client.addFriend(steamid);
	}
	
	if (relationship === 3) {
		setTimeout(function() {
			// SEND MESSAGE & INVITE TO GROUP
			client.chatMessage(steamid, message);
			client.inviteToGroup(steamid, config.groupID);
			console.log("Action against: " + steamid);
			
			// REMOVE FRIEND
			setTimeout(function() {
				client.removeFriend(steamid)
				console.log("Removed friend: " + steamid);
			}, 5000);
		}, delay);
	}
});

// FRIENDSLIST
client.on("friendsList", function() {
	console.log("%j", client.myFriends);	
});

// REPLY WITH NO-REPLY MESSAGE
client.on('friendMessage', function(steamid, message) {
	client.chatMessage(steamid, messageNoReply);
});

Thank you all for helping around within this community! :)
 

Edited by NULL;
Updated code.
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...