'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)*
Solution 1:[1]
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 });
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Vxrious |
