discord js message.mentions.users.first() error code example
Example 1: discord.js get first mention
let member = msg.members.mentions.first();
if(msg.content === 'name'){
msg.channel.send(member)
}
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);
});