Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

186
Views
Cómo detectar si un mensaje no está en blanco

He estado tratando de crear un sistema de modmail donde puede enviar imágenes al equipo de soporte, pero es MessageEmbed field value may not be blank (esto es para la inserción donde está el mensaje). ¿Cómo puedo detectar si hay o no texto para acompañar su imagen?

este es mi codigo

 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 answers
Answer question

0

Suponiendo que el resto del código funcione como se esperaba, simplemente cambie esta línea

 Embed.addField("Message:", message.content || 'No message') // this adds a message if none is present
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!