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!