Filter for Message Collector is not working

I'm trying to collect messages that contains at least one attachments, the problem is that the collector return every messages sent even if they have attachments or not ._.
const filterMessage = (msg) => msg.author.id == message.author.id && msg.attachments.size >= 1;
const collectorMessage = message.channel.createMessageCollector({ filterMessage, time: 350000 });

collectorMessage.on('collect', async (msg) => {
console.log('This message contain an image !')
})
const filterMessage = (msg) => msg.author.id == message.author.id && msg.attachments.size >= 1;
const collectorMessage = message.channel.createMessageCollector({ filterMessage, time: 350000 });

collectorMessage.on('collect', async (msg) => {
console.log('This message contain an image !')
})
6 Replies
Unknown User
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
Nelvazz
NelvazzOP•3y ago
Every filter needs to be called filter ? 🤔
Syjalo
Syjalo•3y ago
You don't understand basics of JavaScript. The options should take the filler with key filter { filter: filter } and { filter } do the same thing.
Nelvazz
NelvazzOP•3y ago
So i need to do { filter: filterMessage } ?
Syjalo
Syjalo•3y ago
Yes
Nelvazz
NelvazzOP•3y ago
Oh okay that's logic now (i didn't knew about this thx)

Did you find this page helpful?