feat: get contact's profile picture
This commit is contained in:
parent
004312a99f
commit
f2b286a319
2 changed files with 13 additions and 0 deletions
|
|
@ -61,6 +61,7 @@ Take a look at [example.js](https://github.com/pedroslopez/whatsapp-web.js/blob/
|
||||||
| Promote/demote group participants | ✅ |
|
| Promote/demote group participants | ✅ |
|
||||||
| Mention users | _pending_ |
|
| Mention users | _pending_ |
|
||||||
| Get contact info | ✅ |
|
| Get contact info | ✅ |
|
||||||
|
| Get profile pictures | ✅ |
|
||||||
|
|
||||||
Something missing? Make an issue and let us know!
|
Something missing? Make an issue and let us know!
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -91,6 +91,18 @@ class Contact extends Base {
|
||||||
|
|
||||||
return super._patch(data);
|
return super._patch(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the contact's profile picture URL, if privacy settings allow it
|
||||||
|
* @returns {Promise<string>}
|
||||||
|
*/
|
||||||
|
async getProfilePicUrl() {
|
||||||
|
const profilePic = await this.client.pupPage.evaluate((contactId) => {
|
||||||
|
return window.Store.Wap.profilePicFind(contactId);
|
||||||
|
}, this.id._serialized);
|
||||||
|
|
||||||
|
return profilePic ? profilePic.eurl : undefined;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue