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

266
Vistas
Interaction Channel messages (Discord.js v13)
            let messages = await interaction.channel.messages.fetch();

       messages.then(async (messages) => {
           const output = messages.array().reverse().map(m => `${new Date(m.createdAt).toLocaleString('en-US')} - ${m.author.tag}: ${m.attachments.size > 0 ? m.attachments.first().proxyURL : m.content}`).join('\n');

           console.log(output)
       })

and when I get this console log my console log this error:

    C:\Users\test7\Desktop\ThunderBot\events\bot\slash-interactionCreate.js:195
           messages.then(async (messages) => {
                    ^
    TypeError: messages.then is not a function

interaction.channel data: https://hastebin.com/uwocabepoq.yaml

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

You are already awaiting the messages. This gives the Collection of messages which does not have the .then method (.then exists on Promise instances, but not unchanged Collection instances). Either remove await to get the Promise instance or run that without the .then

Removing await

let messages = interaction.channel.messages.fetch();
messages.then(async (messages) => {
    const output = messages.array().reverse().map(m => `${new Date(m.createdAt).toLocaleString('en-US')} - ${m.author.tag}: ${m.attachments.size > 0 ? m.attachments.first().proxyURL : m.content}`).join('\n');
    console.log(output)
})

Removing .then

let messages = await interaction.channel.messages.fetch();
const output = messages.array().reverse().map(m => `${new Date(m.createdAt).toLocaleString('en-US')} - ${m.author.tag}: ${m.attachments.size > 0 ? m.attachments.first().proxyURL : m.content}`).join('\n');
console.log(output)
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