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 User15mo ago
Message Not Public
Sign In & Join Server To View
Syjalo
Syjalo15mo 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) Cantcrit15mo ago
Thanks, I have updated my code to this:
(DMG) Cantcrit
(DMG) Cantcrit15mo 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) Cantcrit15mo ago
Accomplished what I wanted to do with this: