Members not a valid property on channels.fetch?

I am trying to make my bot leave a voice channel when there are no more people in there, looking through the docs my code should be correct, but .members is returning undefined so I am not sure how to check how many people are left in the voice channel?
5 Replies
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
Syjalo
Syjalo2y ago
Yes. Because .fetch() returns a Promise. And <Promise>.members isn't a thing. Btw you should have Guilds intent for dsicord.js and all channel should be cached so you don't need to fetch them.
(DMG) Cantcrit
(DMG) CantcritOP2y ago
Thanks, I have updated my code to this:
(DMG) Cantcrit
(DMG) CantcritOP2y ago
I can see the object fine in the console when I log it, but when I try to access channel.members it says it's null
(DMG) Cantcrit
(DMG) CantcritOP2y ago
Accomplished what I wanted to do with this:
Want results from more Discord servers?
Add your server