FIx getProfilePicUrl (#127092)
* Applying correction given on discord * Update Client.js * Update Client.js * Update Client.js --------- Co-authored-by: BenyFilho <168232825+BenyFilho@users.noreply.github.com>
This commit is contained in:
parent
883d7e4eda
commit
d933a0881f
1 changed files with 3 additions and 6 deletions
|
|
@ -1510,16 +1510,13 @@ class Client extends EventEmitter {
|
|||
async getProfilePicUrl(contactId) {
|
||||
const profilePic = await this.pupPage.evaluate(async contactId => {
|
||||
try {
|
||||
const chatWid = window.require('WAWebWidFactory').createWid(contactId);
|
||||
return window.WWebJS.compareWwebVersions(window.Debug.VERSION, '<', '2.3000.0')
|
||||
? await window.require('WAWebContactProfilePicThumbBridge').profilePicFind(chatWid)
|
||||
: await window.require('WAWebContactProfilePicThumbBridge').requestProfilePicFromServer(chatWid);
|
||||
const chat = await window.WWebJS.getChat(contactId);
|
||||
return await window.require('WAWebContactProfilePicThumbBridge').requestProfilePicFromServer(chat);
|
||||
} catch (err) {
|
||||
if(err.name === 'ServerStatusCodeError') return undefined;
|
||||
throw err;
|
||||
}
|
||||
}, contactId);
|
||||
|
||||
return profilePic ? profilePic.eurl : undefined;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue