Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

157
Visualizações
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 Respostas
Responde à pergunta

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 Relatório

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 Relatório

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda