Flashyg1 Posted May 12, 2020 Report Posted May 12, 2020 Need ya help guys the inviteToGroup doesn't work i tried so many diffrent ways but i won't work Thank for every help Quote
SnaBe Posted May 13, 2020 Report Posted May 13, 2020 Since you haven't posted any code I'm unsure how you're using the method. So I'll show you how I usually do it. Let's say you want to invite the user as soon as they become friends with yout bot, you can do it as follows: client.on('friendRelationship', (steamID, relationship) => { switch(relationship) { //The bot received a friend request from another Steam user case 2: console.log(`Bot ${client.steamID.getSteamID64()} received a friend request from user ${steamID}.`); client.addFriend(steamID, (err) => { if(err) { console.log(`Error adding user ${steamID}.`); } else { client.getPersonas([steamID], (err, personas) => { var persona = personas[steamID.getSteamID64()]; var name = persona ? persona.player_name : ("[" + steamID.getSteamID64() + "]"); client.chatMessage(steamID, `Greetings ${name}! ${config.steam.messages.new_friend}`); }); console.log(`Bot ${client.steamID.getSteamID64()} accepted user ${steamID}'s friend request.`); } }); break; //The bot is now friends with another Steam user case 3: //Invite that user to our Steam group client.inviteToGroup(steamID, config.steam.groupID); console.log(`Bot ${client.steamID.getSteamID64()} invited user ${steamID} to our Steam group.`); break; default: break; } }); The inviteToGroup methods takes two arguments, the SteamID of the user you wish to invite and the groupID for the group. The SteamID is retrieved from the friendRelationship event. You'll have to store your Steam group ID in a variable or in a separate file. I store mine in a JSON config file. If you don't have the groupID you can find it by replacing <GroupName> in this url https://steamcommunity.com/groups/<GroupName>/memberslistxml/?xml=1 with the name of your Steam group. Then you'll be able to extract the groupID from the XML file in your browser. I hope this helps! vrtgn 1 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.