1client.on('message', message => {
2 if (message.content == `!collect`) {
3 // Create a message collector
4 const filter = m => (m.content.includes('discord') && m.author.id != client.user.id);
5 const channel = message.channel;
6 const collector = channel.createMessageCollector(filter, { time: 10000 });
7 console.log("collector started");
8 collector.on('collect', m => console.log(`Collected ${m.content}`));
9 collector.on('end', collected => console.log(`Collected ${collected.size} items`));
10 }
11});
12
1// `m` is a message object that will be passed through the filter function
2const filter = m => m.content.includes('discord');
3const collector = message.channel.createMessageCollector(filter, { time: 15000 });
4
5collector.on('collect', m => {
6 console.log(`Collected ${m.content}`);
7});
8
9collector.on('end', collected => {
10 console.log(`Collected ${collected.size} items`);
11});
12