mirror of
https://github.com/FranP-code/Baileys.git
synced 2025-10-13 00:32:22 +00:00
Added profile picture to contact
This commit is contained in:
@@ -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 => {
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user