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

159
Vistas
Serverinfo interaction slash command showing 3 channels, but I have only 2 channels in the server

serverinfo interaction slash command showing 3 channels, but I have only 2 channels in the server. It is including the category too, how I fix it?

Here is the code -

if (commandName === 'serverinfo') {
  let serverinfoembed = new MessageEmbed()
  .setAuthor(`Info for ${interaction.guild.name}`)
  .setColor('#4269f5')
  .addField('Owner', `<@${interaction.guild.ownerId}>`, true)
  .addField('Channels', `${interaction.guild.channels.cache.size}`, true)
  return interaction.reply({ embeds: [serverinfoembed] });
};
about 4 years ago · Juan Pablo Isaza
2 Respuestas
Responde la pregunta

0

You need to filter what channels you want to count for example text channels

interaction.guild.channels.cache.filter(ch => ch.type === 'GUILD_TEXT').size

All of the channel types you can see from here

about 4 years ago · Juan Pablo Isaza Denunciar

0

In Discord.js, it counts categories as channels. To filter out categories, you need to do the following:

interaction.guild.channels.cache.filter(c => c.type !== "GUILD_CATEGORY").size

This will display the amount of cached text and voice channels. Filtering out voice/text channels are just as easy:

//Getting text channels
interaction.guild.channels.cache.filter(c => c.type === "GUILD_TEXT").size
//Getting VCs
interaction.guild.channels.cache.filter(c => c.type === "GUILD_VOICE").size
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