M
M
MoneySMile2021-06-29 11:40:32
Node.js
MoneySMile, 2021-06-29 11:40:32

How can I make such statistics on discord.js?

I need to make statistics like this (preferably through a function):
60dadb6d108b6023632538.png

module.exports = async function(bots,user,message,member) {
}

If possible, it's better to go to the discord (because I have features in the code and connecting functions): Money Smile#6081

Thanks in advance!

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Alexander, 2021-06-29
@MoneySMile

const guild = client.guilds.cache.get("id_сервера");
   setInterval(function () {
      let memberCount = guild.members.cache.filter(member => !member.user.bot).size; 
      /* количество участников на сервере, которые не являются ботами. */ 

      let memberCountChannel = guild.channels.cache.get("id_голосового_канала");
      memberCountChannel.setName(`Участников: ${memberCount}`);
     /*  устанавливаем голосовому каналу название  */

   }, 1000);

if you want to get the number of server members (not bots) that are online:
let onlineMemberCount = guild.members.cache.filter(member => !member.user.bot && member.presence.status === "online").size;

M
MoneySMile, 2021-06-29
@MoneySMile

And how to get all statuses except offline?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question