mirror of
https://github.com/cheveguerra/whatsapp-web.js.git
synced 2026-04-18 03:29:14 +00:00
feat: get contact's profile picture
This commit is contained in:
@@ -61,6 +61,7 @@ Take a look at [example.js](https://github.com/pedroslopez/whatsapp-web.js/blob/
|
||||
| Promote/demote group participants | ✅ |
|
||||
| Mention users | _pending_ |
|
||||
| Get contact info | ✅ |
|
||||
| Get profile pictures | ✅ |
|
||||
|
||||
Something missing? Make an issue and let us know!
|
||||
|
||||
|
||||
@@ -91,6 +91,18 @@ class Contact extends Base {
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user