Jump to content
McKay Development

Emily

Member
  • Posts

    16
  • Joined

  • Last visited

Posts posted by Emily

  1.  

    Thank you I checked the coding again and corrected my shortcomings now everyone can use other commands

     

    I have a question When the person leaves the group, he can still use that command, and someone who joins the group waits for a few minutes to use that command. Can we set this wait time?

    so I don't want him to use the command instantly when he leaves the group

     

    and the person joining the group should not wait, use that command directly

  2. so i mean

    function getGroup(groupName,callback) {
      groupmembers = [];
        community.getSteamGroup(groupName, (err, group) => {
            if (err) {
                console.log("Couldn't get the Group Retrying");
                setTimeout((groupName) => { getGroup(groupName,callback) }, 5000);
            } else group.getMembers((err, members) => {
                if (err) {
                    console.log("Couldn't get the Group Retrying..");
                    setTimeout((groupName) => { getGroup(groupName,callback) }, 5000);
                } else {
                    members.forEach(member => {
                        groupmembers.push(member.accountid);
                    });
                  callback(groupmembers);
                    console.log("Loaded The Group Members");
                }
            });
        });
    
    }
    
    client.on("friendMessage", function (steamID, message) {
    	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 {
            	client.chatMessage(steamID, "bot is still loading message");
        	}
    
        } else if (message == "!help") {
            client.chatMessage(steamID, "Test Message");
          
              } else {
            client.chatMessage(steamID, "You wrote an unknown command. You can type !commands to learn commands.");
        }
            console.log("Message Sender steamID: " + steamID.getSteam3RenderedID() + ": " + message);
    });

     

    this is the sample code 

    I can only use the first command, I want everyone to use the other commands, but other commands don't work

    so !help doesn't work

    I hope you understand thanks in advance <3

     

  3.  

    ok ReferenceError: members is not defined i solved your mistake 

    my current problem is that I want one command to use only group member, doesn't recognize other commands

  4.  

    Thank you man how long have I been looking for this code now the person who is a member of the group is using it, but there is another problem, when this person leaves the group, he still continues to use that command.

    @Perport

     

    and I can't use this command after joining the group

  5. 2 hours ago, Perport said:

    Did you call the getGroup function ? Like

    client.on("loggedOn",()=>{

    getGroup("reddit");

    }

    if(groupmembers.includes(steamID.getSteamID64())){

     

    I'm still getting this error :(

    Cannot read property 'includes' of undefined

    client.on('loggedOn', () => {
        getGroup("mygroupname");
        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(getGroup, 5000);
            } else group.getMembers((err, members) => {
                if (err) {
                    console.log("Couldn't get the Group Retrying..");
                    setTimeout(getGroup, 5000);
                } else {
                    groupmembers = members;
                }
            });
        });
    }
    
    client.on("friendMessage", function(steamID, message) {
        if (message == "!test") {
        if(groupmembers.includes(steamID.getSteamID64())){
            client.chatMessage(steamID, "Test Message");
        }
        else client.chatMessage(steamID,"You have to join our steam group bla bla to use this bot or idk");
        }})

     

    I did it this way but I get the error I said

  6. 12 hours ago, Perport said:
    
    const steamCommunity = require('steamcommunity');
    const client = new steamUser();
    let community = new SteamCommunity();
    let groupmembers;
    // https://steamcommunity.com/groups/reddit 's group name would be "reddit" as a string
    // call getGroup on your code on client loggedOn event or somewhere else you want
    function getGroup(groupName) {
        community.getSteamGroup(groupName, (err, group) => {
            if (err) {
                console.log("Couldn't get the Group Retrying");
                setTimeout(getGroup, 5000);
            } else group.getMembers((err, members) => {
                if (err) {
                    console.log("Couldn't get the Group Retrying..");
                    setTimeout(getGroup, 5000);
                } else {
                    groupmembers = members;
                }
            });
        });
    }
    
    client.on("friendMessage", (steamID,msg) => {
      if(groupmembers.includes(steamID.getSteamID64())){
        //do your thing
      }
      else client.chatMessage(steamID,"You have to join our steam group bla bla to use this bot or idk");
    });

    this should work if you still have problems please let me know

    Cannot read property 'includes' of undefined

  7. On 5/3/2020 at 11:10 AM, xLeeJYx said:

    use getSteamGroup to get the group details and then getMembers to get the steamids of the members in your group. You can store the array somewhere in the code or anywhere u want it. Then check if the id is present in that array when a message is received

     

    how can i do that can you help me please i need it

    @xLeeJYx

  8.  

     

    I'm sorry I couldn't understand what you said

     

    not a steam chat room group people who add the steam bot must be a member of the group to use all commands

    @vrtgn

     

    and, i want people who are not members of the group to send a "you must be a member of the group" message

     
    it starts like this
    client.on("friendMessage"function(steamIDmessage) {
    if (message == "!help") {
    client.chatMessage(steamID"message);
    }
        } else if (message == "!info") {
    client.chatMessage(steamID"message");
     
    ..
    ..
    ..

     

    how can i add as i said?

     

    please help me

  9. client.on("friendMessage"function(steamIDmessage) {
    if (message == "!help") {
                    //code
            }
     
        } else if (message == "!info") {
     
     
    I want to do I want only the members of the group to use the !help command.
     
    I want people who are not members of the group to send a "you must be a member of the group" message
  10. 12 hours ago, vrtgn said:

    Check if the incoming message is only from those "group members" by using their steam ID 64.

    can you code sample?

     

    For example, I want to use the !help command only by people who are members of the group.
×
×
  • Create New...