dm message collector discordjs

Solutions on MaxInterview for dm message collector discordjs by the best coders in the world

showing results for - "dm message collector discordjs"
Mohammed
21 Jan 2019
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
Muriel
15 Oct 2017
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