How to get a list of all channels ? #9890
-
Hey I am new to discord.js will anyone please let me know How I will get the list of all channels? |
Beta Was this translation helpful? Give feedback.
Answered by
almostSouji
Oct 24, 2023
Replies: 2 comments
-
The bot client as a |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
almostSouji
-
bot.channels.cache.forEach((channel) => console.log(channel.name)); will print every channel name currently in the bots cache. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The bot client as a
.channels
manager which exposes a.cache
of all the channels in all the servers your bot is in. If you just want the channels of a specific server (guild), theGuild
structure behaves similarly.