如何在 v13 中使用 discord.js 获取少于 10 个成员的公会名称

how to get the guild name that have less than 10 members using discord.js in v13

我想在频道中发送少于 10 个成员的公会名单。 {使用 discord.js v13}

我的代码


guild.channels.cache.forEach((channel) => {
        if (channel.type === 'text' && !targetChannel && channel.permissionsFor(guild.me).has("SEND_MESSAGES")) targetChannel = channel
    })


  if(guild.memberCount < 10 ) {
     message.channel.send (guild.name);
  }

你可以做到

client.guilds.cache.forEach(g => {
   if(g.memberCount < 10) {
      message.channel.send(g.name) 
   }
})