Added profile picture to contact

This commit is contained in:
Adhiraj Singh
2020-11-17 13:19:19 +05:30
parent 781f586b6f
commit f68a14bff8
2 changed files with 9 additions and 5 deletions

View File

@@ -252,11 +252,15 @@ export class WAConnection extends Base {
// profile picture updates
this.on('CB:Cmd,type:picture', async json => {
const jid = whatsappID(json[1].jid)
const chat = this.chats.get(jid)
if (!chat) return
const imgUrl = await this.getProfilePicture(jid)
const contact = this.contacts[jid]
if (contact) contact.imgUrl = imgUrl
await this.setProfilePicture (chat)
this.emit ('chat-update', { jid, imgUrl: chat.imgUrl })
const chat = this.chats.get(jid)
if (chat) {
chat.imgUrl = imgUrl
this.emit ('chat-update', { jid, imgUrl })
}
})
// status updates
this.on('CB:Status', async json => {

View File

@@ -191,12 +191,12 @@ export interface WAContact {
/** short name for the contact */
short?: string
// Baileys Added
imgUrl?: string
lastKnownPresence?: Presence
lastSeen?: number
}
export interface WAUser extends WAContact {
phone: any
imgUrl?: string
}
export interface WAChat {
jid: string