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

182
Vistas
How to detect if a message is not blank

I've been trying to create a modmail system where you can send images to the support team, but I get MessageEmbed field value may not be blank (this is for the Embed where the message is). How can I detect if there is or is not any text to go along with their image?

This is my code

const Embed = new Discord.MessageEmbed()
            .setAuthor("Message from recipient", message.author.displayAvatarURL())
            .setDescription(`A message has been recieved from ${message.author.tag}`)
          if (message.attachments.size < 0) {
            Embed.addField("Message:", message.content)
          } else {
            if (message.attachments.every(attachIsImage)) {
              
              Embed.setImage(message.attachments.first())
            }
          }

          function attachIsImage(msgAttach) {
            var url = msgAttach.url;
            //True if this url is a png image.
            return url.indexOf("png", url.length - "png".length /*or 3*/) !== -1;
          }
about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

Assuming the rest of the code works as expected just change this line

Embed.addField("Message:", message.content || 'No message')
// this adds a message if none is present
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