message.mentions.members.first() discord.js code example
Example 1: check if message mentions users discord js
if (<Message>.mentions.members.size) {
}
if (<Message>.mentions.members.first()) {
}
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);
});