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

408
Vistas
Error: Message content must be a non-empty string. || if (typeof data !== 'string') throw new error(errorMessage);

Hi i have problem with using guild on my discord bot. Whenever i want to return the amount of the users on my server i recive this error

if (typeof data !== 'string') throw new error(errorMessage);

RangeError [MESSAGE_CONTENT_TYPE]: Message content must be a non-empty string.

if (cmd === `name`) { //This is working when used on discord text-channel
        msg.reply(msg.guild.name)
    }
    if (cmd === `users`) {  //This is not working when used on discord text-channel
        msg.reply(msg.guild.memberCount)
    }
about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

The memberCount property returns a number which you are trying to send in a channel. The problem is that sending a number is not allowed. Your message content must always be a string.

You can solve this problem by using the String function to send a number. Your command will look like this:

if(cmd === `users`){
    msg.reply(String(msg.guild.memberCount));
}
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