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

88
Views
discord.js - MessageCollector won't end

The collector won't end, even if there is time set to 1.

const filter = msg => msg.author.id === message.author.id;

const collector = new MessageCollector(message.channel, filter, {
    max: 3,
    time: 5000,
})

collector.on('collect', collector => {
    console.log(`${collector.content}`)
})

collector.on('end', collected => {
    console.log(`${collected.size}`)
})
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

The constructor takes arguments (channel, options) and not (channel, filter, options). filter should be part of the options object. See docs.

Right now you are passing the filter function instead of an options object, followed by what should be an options object but is actually just an ignored superfluous third argument.

This is the correct way:

const collector = new MessageCollector(message.channel, {
    filter,
    max: 3,
    time: 5000
})
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!