Fetching Channels v13

Hey , guys im trying to fetch all text channels in a guild with a specific name. so at first i just use
const Channels = await interaction.guild.channels.fetch();
console.log(Channels);
const Channels = await interaction.guild.channels.fetch();
console.log(Channels);
which show all the channels in guild perfectly. for the next step that i wanna filter to get text channels only with a specific name i dont get the right thing ( or at least i think so).
const OrganizerEmoji = Array.from(Organizer.nickname)[0];
const TextChannels = Channels.map((c) => c.type === 'GUILD_TEXT' && c.name.includes(`${OrganizerEmoji}`));
console.log(TextChannels);
const OrganizerEmoji = Array.from(Organizer.nickname)[0];
const TextChannels = Channels.map((c) => c.type === 'GUILD_TEXT' && c.name.includes(`${OrganizerEmoji}`));
console.log(TextChannels);
and the respond i get is
[
false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false, false,
false, false, false, false,
... 198 more items
]
[
false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false, false,
false, false, false, false,
... 198 more items
]
11 Replies
d.js toolkit
d.js toolkit2y ago
• 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.
Violet
VioletOP2y ago
Exact discord version : ├─┬ [email protected] │ └── [email protected] deduped └── [email protected] Node Version : v16.13.1
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
Violet
VioletOP2y ago
yeah i got it enabled actually
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
d.js docs
d.js docs2y ago
const channel = client.channels.cache.get("222086648706498562");
const channel = guild.channels.cache.find(channel => channel.name === "general");
const channel = client.channels.cache.get("222086648706498562");
const channel = guild.channels.cache.find(channel => channel.name === "general");
• Caches in discord.js are Collections which extend the native Map structure. • learn more
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
Violet
VioletOP2y ago
🫠 that was really a great help 🙂 , it worked , just in advanced why doesnt map work for that? yeah worked perfectly
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
Violet
VioletOP2y ago
oh ok 🔥 thanks a lfor the big help <3👽
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
Want results from more Discord servers?
Add your server