'Discord.js collector filter is not working?

So, I have this part of the code from a quiz bot made with discord.js.
I set collector filter max: 1, but when 2 or more users reply with the correct answer in the same SECOND, they both get the points and it should be only one user, not 2 or more.

Example of this occurring: Example

The code:

const filter = (m) => !m.author.bot && m.content.toLowerCase() == current.answer.toLowerCase();
const collector = message.channel.createMessageCollector({ filter, max: 1, time: 45000 });

collector.on('collect', async m => {
    if (stop == true) return;
    if (m.content == null || current.answer == null || m.content.toLowerCase() != current.answer.toLowerCase()) return;

    collector.stop();

    remaining = Date.now() - time;
    points = remaining <= 5000 ? 10 : (remaining <= 15000 ? 8 : remaining <= 25000 ? 6 :(remaining < 35000 ? 4 : 2));

    message.channel.send(`Correct! The answer is **${current.answer}**\n**${m.author.tag}**! You got **${points}** points!`).catch((err) => {console.log(err)});
                        
    if (fs.existsSync(`./system/users/${m.author.id}.json`)) {
        data = JSON.parse(fs.readFileSync(`./system/users/${m.author.id}.json`));
        data.total += points;
        data.current += points;
        data.tag = m.author.tag;
        fs.writeFileSync(`./system/users/${m.author.id}.json`, JSON.stringify(data, null, 4));
    } else {
        fs.writeFileSync(`./system/users/${m.author.id}.json`, JSON.stringify({
            "id": m.author.id,
            "tag": m.author.tag,
            "current": points,
            "total": points
        }, null, 4));
    }
    await wait(5000);
    return(md('NEXT'));
});


Solution 1:[1]

As you haven't provided the code where the original message is defined, it's hard to find an exact answer to the issue.

One method would be to check the authors ID against the original message, like so:

const filter = (m) => m.author.id === <Message>.author.id

Full example:

const filter = (m) => !m.author.bot && m.content.toLowerCase() == current.answer.toLowerCase() && m.author.id === <Message>.author.id;

Replacing <Message> with the original message object.

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 Tyler2P