Jump to content
McKay Development

Emily

Member
  • Posts

    16
  • Joined

  • Last visited

Reputation Activity

  1. Thanks
    Emily reacted to Perport in solved.   
    client.on("friendMessage", function (steamID, message) { if(message == "!test" || message == "!put these commands like this here you want only groupmembers to use" || message == "!anothercmd"){ getGroup("mygroupname",members => { if (members.length > 0) { if (message == "!test") { if (members.includes(steamID.accountid)) { client.chatMessage(steamID, "Test Message"); } else client.chatMessage(steamID, "You have to join our steam group"); } else if(message == "!membercmd2"){ // } } else { client.chatMessage(steamID, "bot is still loading message"); } }); } else if(message == "!help"){ } else if (message == "!idk"){ } else{ console.log("Unknown command type \"!help\" to see available commands") } }); This should I might have made some mistakes here and there I'm currently on mobile so I can't test it so try it and let me know.
    And Please indent this code or something it's starting to look weird.
  2. Thanks
    Emily reacted to Perport in solved.   
    I justed tested it on a bigger group.
    It takes about a minute or so to load it so I though printing it to a console would help.
    Made the groupmembers var array from the beginning so it won't give you an error when someone types while it's still loading.
    Fixed few things about what bot does when it fails to get the group or its members.
    And made the array keep their accountids instead of steamid objects.
    Here is the code :
    client.on('loggedOn', () => { console.log("LoggedOn"); getGroup("yourgroupname"); client.setPersona(SteamUser.EPersonaState.LookingToTrade); client.gamesPlayed(["Test Bot", 730]); }); let groupmembers = []; function getGroup(groupName) { community.getSteamGroup(groupName, (err, group) => { if (err) { console.log("Couldn't get the Group Retrying"); setTimeout((groupName) => { getGroup(groupName) }, 5000); } else group.getMembers((err, members) => { if (err) { console.log("Couldn't get the Group Retrying.."); setTimeout((groupName) => { getGroup(groupName) }, 5000); } else { members.forEach(member => { groupmembers.push(member.accountid); }); console.log("Loaded The Group Members"); } }); }); } client.on("friendMessage", function (steamID, message) { if (groupmembers.length > 0) { if (message == "!test") { if (groupmembers.includes(steamID.accountid)) { client.chatMessage(steamID, "Test Message"); } else client.chatMessage(steamID, "You have to join our steam group bla bla to use this bot or idk"); } } else { client.chatMessage(steamID, "bot is still loading message"); } }); If you still have problems or questions feel free to ask
  3. Confused
×
×
  • Create New...