Jump to content
McKay Development

Seeringfate

Member
  • Posts

    5
  • Joined

  • Last visited

Everything posted by Seeringfate

  1. Fixed it by adding an extra table in MySQL and saving data there and after the trade is accepted or declined remove the data and execute code according to data in table. Thank for the help !
  2. Hi there, Is there a way to save sent offers to a file (save some needed information in it + the tradeoffer), that when this offer is accepted (or declined) that you run a block of code attached to this file ? As I see it now with the "receivedOfferChanged" you can only check if the offer is changed and do something with the steamid from the recipient. I want to run code which also use mySQL databases, so I need a way to save offers. If this is too much to ask it's alright. Thanks anyway ! Seeringfate
  3. I fixed it, for people who have the same issue, here is what I did: first I created a new array containing all accountid's from the group members: const groupMembers = []; community.getGroupMembers('GROUPID', function(err, members) { for(x = 0; x < members.length; x++) { groupMembers.push(members[x].accountid); } }); after that I compared it to the acountID from the getGroupMembers function: client.on("friendRelationship", (steamid, reletionship, name) => { if (reletionship === 2) { community.getGroupMembers('GROUPID', function(err, members) { if (groupMembers.indexOf(steamid.accountid) > -1) { client.addFriend(steamid); client.chatMessage(steamid, `Thank you for adding me!`); console.log(`Friends request accepted, member. SteamID: ${steamid}`); } else if (err){ console.log(err); } else { client.removeFriend(steamid); console.log(`Ignored friends request, not in the group. SteamID: ${steamid}`); } }); } });
  4. This worked, this only created a new problem: the getGroupMembers has a Steam3ID output while my code works with SteamID64. So I can get the array and find my string there, but how do I convert the Steam3ID to a SteamID64 ? My code now: // Accepting friends requests. client.on("friendRelationship", (steamid, reletionship) => { if (reletionship === 2) { community.getGroupMembers('GROUPID', function(err, members) { if (members.indexOf(steamid) > -1) { client.addFriend(steamid); client.chatMessage(steamid, `Thank you for adding me!`); console.log(`Friends request accepted, is group member. SteamID: ${steamid}`); } else if (err){ console.log(err); } else { client.removeFriend(steamid); console.log(`Ignored friends request, not in the group. SteamID: ${steamid}`); } }); } }); Thanks !
  5. Hi there, I'm trying to get my bot to accept friends request from members from my group. My code is not fully working, it keep getting errors at "community.groups(steamid). Here is my code: client.on("friendRelationship", (steamid, reletionship, name) => { if (reletionship === 2) { var userGroups = community.groups(steamid) if (userGroups.indexOf(wantedGroupID) != -1) { client.addFriend(steamid); client.chatMessage(steamid, `Thank you for adding me!`); console.log(`Friends request from ${name} accepted, IdleNet member. SteamID: ${steamid}`); } else { client.removeFriend(steamid); console.log(`Ignored friends request from ${name}, not in the IdleNet group. SteamID: ${steamid}`); } } });This is before my code: const SteamUser = require('steam-user'); const SteamTotp = require("steam-totp"); const SteamCommunity = require("steamcommunity"); const TradeOfferManager = require("steam-tradeoffer-manager"); var wantedGroupID = 'groupid'; const client = new SteamUser(); const community = new SteamCommunity(); const manager = new TradeOfferManager({ steam: client, community: community, language: "en" }); const logOnOptions = { accountName: 'name', password: 'pass', twoFactorCode: SteamTotp.generateAuthCode("secret") }; client.logOn(logOnOptions); client.on('loggedOn', () => { console.log('Logged into Steam'); client.setPersona(SteamUser.Steam.EPersonaState.Online) client.gamesPlayed("Testing"); }); client.on("webSession", (sessionid, cookies) => { manager.setCookies(cookies); community.setCookies(cookies); community.startConfirmationChecker(10000, "secret"); }); Could someone help me ? Thanks !
×
×
  • Create New...