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

189
Vistas
How can I collect a photo submitted by a user?

How can I collect a photo submitted by a user and send it in an embed? I'm using discord.js v13.

I've got the following code but img is not an image URL:

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 Respuestas
Responde la pregunta

0

awaitMessages returns a collection of messages. Even if it's a single message it's still in a collection. As you set up your filter correctly, the collected message will be collected.first().

Messages have an attachments property, a collection of attachments in the message, so the image will be the first item in the collection; collected.first().attachments.first(). To grab the URL you can use either its url property:

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 Denunciar

0

Here's what you can try defining image as

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