How can I get online members and members on the voices

I want to get online and voice active members in commands like this :
const { SlashCommandBuilder } = require('discord.js');

module.exports = {
data: new SlashCommandBuilder()
.setName('ping')
.setDescription('Replies with Pong!'),
async execute(interaction) {
await interaction.reply('Pong!');
//log all online members
//show how many members are on the voices now
},
};
const { SlashCommandBuilder } = require('discord.js');

module.exports = {
data: new SlashCommandBuilder()
.setName('ping')
.setDescription('Replies with Pong!'),
async execute(interaction) {
await interaction.reply('Pong!');
//log all online members
//show how many members are on the voices now
},
};
I want for example if user use this command it sends the count of online and active members
10 Replies
d.js toolkit
d.js toolkit5mo ago
- What's your exact discord.js npm list discord.js and node node -v version? - Not a discord.js issue? Check out #other-js-ts. - Consider reading #how-to-get-help to improve your question! - Explain what exactly your issue is. - Post the full error stack trace, not just the top part! - Show your code! - Issue solved? Press the button!
treble/luna
treble/luna5mo ago
wdym by active because online is active for me
theopenroad
theopenroad5mo ago
what ? can you demonstrate
treble/luna
treble/luna5mo ago
i am asking you to elaborate
theopenroad
theopenroad5mo ago
I mean members on voices
d.js docs
d.js docs5mo ago
property VoiceChannel#members The members in this voice-based channel
theopenroad
theopenroad5mo ago
Thank you what about online members
treble/luna
treble/luna5mo ago
you'd need the GuildPresences intent, then fetch the members and map over them to check
d.js docs
d.js docs5mo ago
property GuildMember#presence The presence of this guild member
theopenroad
theopenroad5mo ago
Thanks a lot