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

223
Visualizações
trying to make leaderboard top servers in members count discord.js v13

i'm trying to make top server's in members count and this is my code:

const embed = new Discord.MessageEmbed()
.setAuthor({ name: `Top Server's`, iconURL: client.user.displayAvatarURL()})
.setColor('#545db8')
for (i = 0; i < 3; i++) {
let guild = client.guilds.cache.sort((a, b) => b.memberCount - a.memberCount).array()[i];
embed.setDescription(`**${i + 1}. ${guild.name}** \n \n Member count: \`${guild.memberCount}\` \n ID: \`${guild.id}\`\n Server Age: <t:${parseInt(guild.createdAt / 1000)}:R>`)
embed.setThumbnail(guild.iconURL())
msg.channel.send({ embeds: [embed] })
}

the error:

TypeError: client.guilds.cache.sort(...).array is not a function

i was using this in v12 and it was working but when i switch to v13 it start showing errors, i've looked up in the discord.js docs but can't find anything

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

let guild = [...client.guilds.cache.sort((a, b) => b.memberCount - a.memberCount).values()][i];

These methods existed to provide access to a cached array of Collection values and keys respectively, which other Collection methods relied on internally. Those other methods have been refactored to no longer rely on cache, so those arrays and these methods have been removed.

You should instead construct an array by spreading the iterators returned by the base Map class methods.

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