Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Fetch All Discord Servers Owners

So i want to get the name of all the discord server owners that my bot is in. DiscordJs v14

I tried using this:
`

const Guilds = client.guilds.cache.map(guild => guild.fetchOwner());
console.log(Guilds);

But it returned me this:Promise { }`

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

I also saw tried this: Get server owners from what servers the bot is in but it does not work on discordjs v14

>Solution :

You have to use Promise#all() to wait for all the promises to resolve

const owners = await Promise.all(client.guilds.cache.map(guild => guild.fetchOwner()));
console.log(owners);
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading