简体   繁体   中英

Discord.js How i check id of members all guilds?

Discord.js Version 11.4.2

Answer in below

  if(message.content === '!listid'){
    console.log("See id members all guild")
  };

Discord.js Version 11.4.2

1.We need to check id of guild first

2.Get id of guild

3.Console.log members id of guild

  if(message.content === '!listid'){
    client.guilds.forEach(member => {
      console.log(`${member.id}`)

      var idserver = (`${member.id}`) // id each guild
      var memserver = client.guilds.get(idserver); // check guild with id

      memserver.members.forEach(member => {
        console.log(member.user.id); // console.log see id user in that guild
      }); // get userid all guild
    });
  };

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM