#Channel.id, .type etc returning undefined.

1 messages · Page 1 of 1 (latest)

sterile loom

I'm trying to loop through all text channels in a guild however am running into some issues.

        guild.channels.fetch().then(() => {
            console.log('All channels have been cached for the guild');

            let channels = guild.channels.cache;

            for(const channel of channels) {
                console.log(channel.type)
                if(channel.type === 'GUILD_TEXT') {
                    console.log(channel.id)
                }
            }
        });```
Whenever I run this,  ``console.log(channel.type)`` ALWAYS logs ``undefined`` in console. This is also the same for any property of channel such as ``channel.id``, ``channel.createdAt`` etc. If I print ``channel`` just by it self though it prints the channel object as seen below:

https://pastebin.com/raw/dGBYDRVg