i'm new to Discord.js, and trying to make server info command like on the picture below. I'm stuck in the moment where i need to get all guild members and filter them by current status and `bot` property. I read <https://discordjs.guide/popular-topics/common-questions.html> and it says that i need to fetch all guild members:

```js
msg.guild.members.fetch().then(fetchedMembers => {
    const totalOnline = fetchedMembers.filter(member => member.presence.status === 'online');
    msg.channel.send(`There are currently ${totalOnline.size} members online in this guild!`);
});

```

My command is sent as an embed, and i'm adding filtered members count into a variable, and then this value inserting into a embed field. If i send embed to a channel right inside then() block, it's working, embed fields are added correctly. But i need to add another information about guild, such as channels count, owner, region etc. If i create fields out of then(), instead of the count i get `undefined`.

P.S. sorry for my poor English, i'm not a native speaker