#List all channels in v14

5 messages · Page 1 of 1 (latest)

stiff comet
#

• What's your exact discord.js npm list discord.js and node node -v version?
• Post the full error stack trace, not just the top part!
• Show your code!
• Explain what exactly your issue is.
• Not a discord.js issue? Check out #useful-servers.

random patio
#
const textChannels = this.interaction.message.guild.channels.cache.filter((channel) => channel.type === 'text');
textChannels.forEach((channel) => console.log(channel.name));

There is no error, but it's just empty array even that I have channels

soft depot
#

Types are not strings; they're enum members

stone hareBOT
#

Instead of using method-based type guard functions, you can narrow channel types with the .type property

- channel.isText()
+ channel.type === ChannelType.GuildText