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
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![email protected] /Users/andriy/Documents/projects/discord-bot
├─┬ [email protected]
│ └── [email protected] deduped
└── [email protected]
Node: v16.20.1
Unknown User•9mo 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•9mo ago
Message Not Public
Sign In & Join Server To View
yes thats what I did (see updated code) still collection is 0
Unknown User•9mo ago
Message Not Public
Sign In & Join Server To View
^ removed fetching the channel, still
Collection(0) [Map] {}
Unknown User•9mo 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'
]
the function
Unknown User•9mo 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•9mo 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