How do you get a voice channel's user list?

Hi, I'm building a bot that: can join a voice channel on slash command and: start recording the list of users that are in this channel, repeat every one second afterwhich, output the list of users to a database in the following way: for(each user){ if(user is not already in database:) add user to database and set (number of seconds user is in channel with bot) to 1 else increment (number of seconds user is in channel with bot) in database } Right now, I'm having trouble with trying to get the "list of users in voice chat right now" data and I couldn't find documentation on the website for this. Does anyone have any ideas how I can do this?
2 Replies
d.js toolkit
d.js toolkit2mo ago
- What are your intents? GuildVoiceStates is required to receive voice data! - Show what dependencies you are using -- generateDependencyReport() is exported from @discordjs/voice. - Try looking at common examples: https://github.com/discordjs/voice-examples. - 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!
Xilophinum
Xilophinum2mo ago
Obtain the GuildMember via the interaction through interaction.member which will give you the .voice.channel.members Collection (so long as that person is in a voice channel) and then just map the properties you are wanting to save in the database.
No description
Want results from more Discord servers?
Add your server