This is the code
module.exports = async (client) => {
let myGuild = client.guilds.cache.get(guild.id)
setInterval(() =>{
var onlineCount = myGuild.members.cache.filter(member => member.presence?.status != "offline").size
let memberCountChannel = myGuild.channels.cache.get(channel.id);
console.log(onlineCount.name);
memberCountChannel.setName(onlineCount + 'people online')
.then(result => console.log(result))
.catch (error => console.log(error));
}, 5000)
}
And this is the part that counts the members
var onlineCount = myGuild.members.cache.filter(member => member.presence?.status != "offline").size
What the terminal shows
undefined
undefined
undefined
undefined
undefined