feat: handle picture change events

This commit is contained in:
Adhiraj Singh
2022-09-27 11:28:41 +05:30
parent da359aaee2
commit b329c73b20
3 changed files with 39 additions and 4 deletions

View File

@@ -152,6 +152,17 @@ const startSock = async() => {
console.log(events['chats.update'])
}
if(events['contacts.update']) {
for(const contact of events['contacts.update']) {
if(typeof contact.imgUrl !== 'undefined') {
const newUrl = contact.imgUrl === null ? null : await sock!.profilePictureUrl(contact.id!)
console.log(
`contact ${contact.id} has a new profile pic: ${newUrl}`,
)
}
}
}
if(events['chats.delete']) {
console.log('chats deleted ', events['chats.delete'])
}