#how to check if the chat is with a contact?
11 messages · Page 1 of 1 (latest)
chat.isGroup
no I meant if the chat is from a contact or it's an unknown number
const contact = chat.getContact();
console.log(contact.isMyContact);
How do you get chat? I only have message
It depends on where you need to get it
When I receive a message I want to know if it's from someone saved in my contacts or not
Even if It's in a group
Post your code
client.on('message', async message => {
if (message.isMyContact) {
}
else{
console.log('not from contact' );
}
})
client.on('message', async message => {
const contact = await message.getContact();
if (contact.isMyContact) {
}else{
console.log('not from contact' );
}
});