How can I loop through all guilds and log the name

My bot is in over 4700 guilds and I set shards: auto I am not familiar with discord.js so if you could provide a short snippet it would be very helpful!
3 Replies
d.js toolkit
d.js toolkit10mo ago
- What's your exact discord.js npm list discord.js and node node -v version? - Not a discord.js issue? Check out #other-js-ts. - Consider reading #how-to-get-help to improve your question! - Explain what exactly your issue is. - Post the full error stack trace, not just the top part! - Show your code! - Issue solved? Press the button! - Marked as resolved by OP
Anthony
AnthonyOP10mo ago
I already tried that but appearantly I need to use broadcastEval (because of the sharding I guess?) https://discord.com/channels/222078108977594368/824411059443204127/1208498366909120574: add all your guilds to an array with broadcastEval and iterate over that I am just not sure how to do that
Discord
Discord - A New Way to Chat with Friends & Communities
Discord is the easiest way to communicate over voice, video, and text. Chat, hang out, and stay close with your friends and communities.
Anthony
AnthonyOP10mo ago
I think its internal sharding I just set shard: auto oh well this logs undefined
client.guilds.cache.forEach(guild => {
console.log(guild.name)
});
client.guilds.cache.forEach(guild => {
console.log(guild.name)
});
I think I was just missing the guilds intent
Want results from more Discord servers?
Add your server