mirror of
https://github.com/cheveguerra/whatsapp-web.js.git
synced 2026-04-18 19:49:16 +00:00
feat: get profile pic url by user ID
This moves the function from Contact to Client to enable getting profile picture without requiring a conversation before. The old function is still available on Contact for convenience and backwards-compatibility.
This commit is contained in:
@@ -103,11 +103,7 @@ class Contact extends Base {
|
||||
* @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;
|
||||
return await this.client.getProfilePicUrl(this.id._serialized);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user