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

182
Views
¿Cómo puedo recopilar una foto enviada por un usuario?

¿Cómo puedo recopilar una foto enviada por un usuario y enviarla en una inserción? Estoy usando discord.js v13.

Tengo el siguiente código, pero img no es una URL de imagen:

 interaction.reply({ content: 'Envia alguna imagen...' }).then(async () => { const atch_filter = (m) => !!m.attachments || m.startsWith('https'); const collected = await interaction.channel.awaitMessages({ filter: atch_filter, max: 1, }); var img = collected.first().url; const embed = new MessageEmbed() .setTitle('Foto recibida') .setImage(img) .setColor('BLUE'); interaction.editReply({ content: 'Listo!', embeds: [embed] }); });
about 4 years ago · Juan Pablo Isaza
2 answers
Answer question

0

awaitMessages devuelve una colección de mensajes. Incluso si es un solo mensaje, todavía está en una colección. A medida que configura su filtro correctamente, el mensaje recopilado será collected.first() .

Los mensajes tienen una propiedad de attachments , una colección de archivos adjuntos en el mensaje, por lo que la imagen será el primer elemento de la colección; collected.first().attachments.first() . Para capturar la URL, puede usar su propiedad url :

 const atch_filter = (m) => !!m.attachments || m.startsWith('https'); const collected = await interaction.channel.awaitMessages({ filter: atch_filter, max: 1, }); const img = collected.first().attachments.first().url;
about 4 years ago · Juan Pablo Isaza Report

0

Esto es lo que puede intentar definir imagen como

 let image = collected.attachments.first() ? message.attachments.first().proxyURL : null
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!