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
|
// profile picture updates
|
||||||
this.on('CB:Cmd,type:picture', async json => {
|
this.on('CB:Cmd,type:picture', async json => {
|
||||||
const jid = whatsappID(json[1].jid)
|
const jid = whatsappID(json[1].jid)
|
||||||
const chat = this.chats.get(jid)
|
const imgUrl = await this.getProfilePicture(jid)
|
||||||
if (!chat) return
|
const contact = this.contacts[jid]
|
||||||
|
if (contact) contact.imgUrl = imgUrl
|
||||||
|
|
||||||
await this.setProfilePicture (chat)
|
const chat = this.chats.get(jid)
|
||||||
this.emit ('chat-update', { jid, imgUrl: chat.imgUrl })
|
if (chat) {
|
||||||
|
chat.imgUrl = imgUrl
|
||||||
|
this.emit ('chat-update', { jid, imgUrl })
|
||||||
|
}
|
||||||
})
|
})
|
||||||
// status updates
|
// status updates
|
||||||
this.on('CB:Status', async json => {
|
this.on('CB:Status', async json => {
|
||||||
|
|||||||
@@ -191,12 +191,12 @@ export interface WAContact {
|
|||||||
/** short name for the contact */
|
/** short name for the contact */
|
||||||
short?: string
|
short?: string
|
||||||
// Baileys Added
|
// Baileys Added
|
||||||
|
imgUrl?: string
|
||||||
lastKnownPresence?: Presence
|
lastKnownPresence?: Presence
|
||||||
lastSeen?: number
|
lastSeen?: number
|
||||||
}
|
}
|
||||||
export interface WAUser extends WAContact {
|
export interface WAUser extends WAContact {
|
||||||
phone: any
|
phone: any
|
||||||
imgUrl?: string
|
|
||||||
}
|
}
|
||||||
export interface WAChat {
|
export interface WAChat {
|
||||||
jid: string
|
jid: string
|
||||||
|
|||||||
Reference in New Issue
Block a user