discord.js check if message sent code example
Example 1: how to check if a user sent a message in discord js
if(message.author.id === client.user.id) return;
Example 2: how to read if a person has send a message on discord.js
client.on('message', message => {
let filter = msg => {
return msg.content.toLowerCase() == message.content.toLowerCase() &&
msg.author == message.author;
}
message.channel.awaitMessages(filter, {
maxMatches: 1,
time: 5 * 1000
}).then(collected => {
}).catch(console.error);
});