I'm trying to get every channel in a discord guild, but it gives me an error message.
if (message.content.startsWith('!get-channels')) {
message.guild.channels.forEach(channel => {
console.log(channel)
})
}
Here is the error message:
message.guild.channels.forEach(channel => {
^
TypeError: message.guild.channels.forEach is not a function
You are getting that error because since discord.js v12 you now need to access Guild Channels using their cache
, so your solution would be to use message.guild.channels.cache.forEach()