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

190
Vistas
Discord.js Array coming as undefined

The command is taking in an image and some text with it in channel-1 and posting the same image and text in channel-2. The image gets posted but the text comes out as undefined but when i print out the value in the console it is not empty.

Input in channel -1 input in channel 1

Output in channel 2 Output in channel 2

Code

    if(!args.length){
        return message.channel.send(`${message.author} There was no input,Command: ${message} ,your input: ${args}`);
    }
    var str= args.toString();
    const values=str.split(' ');
    client.channels.cache.get("channel-id").send({
        files:Array.from(message.attachments.values()),
        content:`${values[1]}`
    });
    console.log(values);
    client.channels.cache.get("channel-id").send(`here it is --- ${values[1]}`);
} 

Console-

Ready
[ 'hello,world' ] 
about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

I think the problem is with your implementation. You are accessing values[1] whereas in the console.log() it appears the values array has only one element i.e at values[0]

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