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

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

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 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!