Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

158
Vistas
How do i make my Bot list every Invite from my Servers (more info in question)

i've been trying to do a invites Command which should find all Invites from the Servers my Bot is on.
(ONLY MY OWN SERVERS)
I do have tried some ideas and code but nothing worked, how to implement it into my Discord Embed i do already know i just need help with the Invite Listing.

client.guilds.forEach(guild => {
    guild.fetchInvites().then(guildInvites => {
        invites[invites.length + 1] = (guild + " - `Invites: " + guildInvites.array().join(", ") + "`");
        ct++;
        if(ct >= client.guilds.size) {
            invites.forEach((invite, i) => {
                if(invite == undefined)
                    invites.splice(i, 1);
            }); 
            invites.shift();
            invites.forEach((invite, i) => invites[i] = "- " + invite);
            invites = invites.join("\n\n");
            let embed = new Discord.RichEmbed()
            .setTitle("All Invites:")
            .setDescription(invites);
            message.channel.send(embed);
        }
    })
});```

Help is much appreciated. 
about 4 years ago · Juan Pablo Isaza
3 Respuestas
Responde la pregunta

0

Are you caching your servers before fetching them? The cache is necessary so the bot can get information from each guild that it is in. Change the first line to

client.guilds.cache.forEach(() => {
  // ...
}

Got this code from this answer here.

about 4 years ago · Juan Pablo Isaza Denunciar

0

From the previous answers and comments on them, I can guess that you either don't have the required intents when instantiating the client class, OR that maybe your client class is not correctly defined.

How do you define client? If it's from another file, try importing it correctly. Don't make multiple clients from a same token/process.

about 4 years ago · Juan Pablo Isaza Denunciar

0

client.guilds.cache.map(guild => {

            let embed = new Discord.RichEmbed()
            .setTitle("All Invites:")



 guild.channels.cache
            .first()
            .createInvite()
            .then((invite) => embed.setDescription(invites.url);)
            .catch(() => embed.setDescription("Lien d'invitation", "Permission Invalides"));
            message.channel.send(embed);
})
about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda