Answer the question
In order to leave comments, you need to log in
How to make a command to count users on the server?
Hello, I am making my discord bot in JavaScript programming language.
I want to make a membercount command to count people on the server, please help!
You can give the necessary arguments (by type member.guild, etc.), but, preferably, complete code.
Thanks in advance.
Answer the question
In order to leave comments, you need to log in
use iterate forEach
:
const list = bot.guilds.cache.get("id_гильдии");
list.members.forEach(member => message.channel.send(member.user.username));
To have the bot send all users with one message, use:
let list = []
let guild = bot.guilds.cache.get('id_гильдии')
guild.members.forEach(m => {
list.push(m.nickname)
})
message.channel.send(list.join(', '))
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question