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) {
|
async getProfilePicUrl(contactId) {
|
||||||
const profilePic = await this.pupPage.evaluate(async contactId => {
|
const profilePic = await this.pupPage.evaluate(async contactId => {
|
||||||
try {
|
try {
|
||||||
const chatWid = window.require('WAWebWidFactory').createWid(contactId);
|
const chat = await window.WWebJS.getChat(contactId);
|
||||||
return window.WWebJS.compareWwebVersions(window.Debug.VERSION, '<', '2.3000.0')
|
return await window.require('WAWebContactProfilePicThumbBridge').requestProfilePicFromServer(chat);
|
||||||
? await window.require('WAWebContactProfilePicThumbBridge').profilePicFind(chatWid)
|
|
||||||
: await window.require('WAWebContactProfilePicThumbBridge').requestProfilePicFromServer(chatWid);
|
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
if(err.name === 'ServerStatusCodeError') return undefined;
|
if(err.name === 'ServerStatusCodeError') return undefined;
|
||||||
throw err;
|
throw err;
|
||||||
}
|
}
|
||||||
}, contactId);
|
}, contactId);
|
||||||
|
|
||||||
return profilePic ? profilePic.eurl : undefined;
|
return profilePic ? profilePic.eurl : undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue