VoiceChannel members is always 0
My bot has all the intents enabled in the Dev Portal and programatically
(including GuildVoiceStates and GuildMembers intents)
In VoiceStateUpdate event I need a total members currently in the voice chat
I tried to force fetch all channels and/or force fetch individually and still not working... I am testing when I have ppl in one of the VCs
![No description](https://answer-overflow-discord-attachments.s3.amazonaws.com/1213111625763258368/6437429.png)
17 Replies
- 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!my-bot@1.0.0 /Users/andriy/Documents/projects/discord-bot
├─┬ discord.js-rate-limiter@1.3.2
│ └── discord.js@14.14.1 deduped
└── discord.js@14.14.1
Node: v16.20.1
Unknown User•5mo ago
Message Not Public
Sign In & Join Server To View
@gwapes updated the code with fetch members and fetch channel individually, still
Collection(0) [Map] {}
couldnt find way to force fetch members though
these are the options:
Unknown User•5mo ago
Message Not Public
Sign In & Join Server To View
yes thats what I did (see updated code) still collection is 0
Unknown User•5mo ago
Message Not Public
Sign In & Join Server To View
^ removed fetching the channel, still
Collection(0) [Map] {}
Unknown User•5mo ago
Message Not Public
Sign In & Join Server To View
Client constructor
🚀 ~ start ~ Config.client.intents: [
'Guilds',
'GuildMembers',
'GuildModeration',
'GuildBans',
'GuildEmojisAndStickers',
'GuildIntegrations',
'GuildWebhooks',
'GuildInvites',
'GuildVoiceStates',
'GuildPresences',
'GuildMessages',
'GuildMessageReactions',
'GuildMessageTyping',
'DirectMessages',
'DirectMessageReactions',
'DirectMessageTyping',
'MessageContent',
'GuildScheduledEvents',
'AutoModerationConfiguration',
'AutoModerationExecution'
]
![No description](https://answer-overflow-discord-attachments.s3.amazonaws.com/1213117193605357589/Screenshot_2024-03-01_at_14.33.33.png)
the function
![No description](https://answer-overflow-discord-attachments.s3.amazonaws.com/1213117564910051359/Screenshot_2024-03-01_at_14.35.49.png)
![No description](https://answer-overflow-discord-attachments.s3.amazonaws.com/1213118005635059743/Screenshot_2024-03-01_at_14.37.35.png)
![No description](https://answer-overflow-discord-attachments.s3.amazonaws.com/1213118005983051796/Screenshot_2024-03-01_at_14.37.28.png)
Unknown User•5mo ago
Message Not Public
Sign In & Join Server To View
@gwapes YES! I removed the cache and it works! Thank you so mmuch! you made my day!
I was super tilted
Unknown User•5mo ago
Message Not Public
Sign In & Join Server To View
took the bot boilerplate and it had this
in case someone else finds this and wonders why the cache is necessary here:
- voice states are received from the initial guild payloads when the bot identifies with the gateway or joins a new server
- the cache is updated based on received voice state update events
- there is no endpoint to fetch the current members of a voice channel