#how to check if the chat is with a contact?

11 messages · Page 1 of 1 (latest)

slate nexus
#

how to check if the chat is with a contact?

vale island
#

chat.isGroup

slate nexus
vale island
#
const contact = chat.getContact();
console.log(contact.isMyContact);
slate nexus
vale island
slate nexus
#

When I receive a message I want to know if it's from someone saved in my contacts or not

slate nexus
vale island
#

Post your code

slate nexus
#
    client.on('message', async message => {

if (message.isMyContact) {

} 
else{
console.log('not from contact' );
} 

}) 
vale island
#
client.on('message', async message => {
const contact = await message.getContact();
if (contact.isMyContact) {

}else{
  console.log('not from contact' );
}
});