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

336
Views
Discord.js collector not ending, ignoring its keys to stop

Hello I have an issue

So I wrote this code to give ranks on discord, but my message collector is ignoring its keys to stop collecting. Can anyone help me fix this issue?

Code:

client.on("messageCreate", message => {
if (message.content === '!rank lol'){
    message.channel.send('Is Yuumi a MID laner?')
}
const collector = new Discord.MessageCollector(message.channel, {max: 1}, {maxProcessed: 1}, {time: 8000})
collector.on('collect', message => {
    if (message.content == "yes") {
        message.channel.send("No rank for you xd!")
        collector.stop()
    } else if (message.content == "no"){
        message.channel.send("You have got the LOL rank!")
        message.member.roles.add("783023112681422849")
        collector.stop
    }


})

})

Discord.js documentation:

*You can control when a collector ends by supplying additional option keys when creating a collector:

time: Amount of time in milliseconds the collector should run for

max: Number of messages to successfully pass the filter

maxProcessed: Number of messages encountered (no matter the filter result)*

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

You passed multiple options seperatly. You need to pass them all in one.

const collector = new Discord.MessageCollector(message.channel, { max: 1, maxProcessed: 1, time: 8000 });
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!