mirror of
https://github.com/EvolutionAPI/evolution-api.git
synced 2025-07-24 17:38:40 -06:00
Update whatsapp.service.ts
This commit is contained in:
parent
1ec3ed32ee
commit
250e67e7ae
@ -1458,21 +1458,20 @@ export class WAStartupService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public async fetchProfile(instanceName: string, number?: string) {
|
public async fetchProfile(instanceName: string, number?: string) {
|
||||||
const jid = (number)
|
const jid = number ? this.createJid(number) : this.client?.user?.id;
|
||||||
? this.createJid(number)
|
|
||||||
: this.client?.user?.id;
|
|
||||||
this.logger.verbose('Getting profile with jid: ' + jid);
|
this.logger.verbose('Getting profile with jid: ' + jid);
|
||||||
try {
|
try {
|
||||||
this.logger.verbose('Getting profile info');
|
this.logger.verbose('Getting profile info');
|
||||||
const business = await this.fetchBusinessProfile(jid);
|
|
||||||
|
|
||||||
if (number) {
|
if (number) {
|
||||||
const info = (await this.whatsappNumber({ numbers: [jid] }))?.shift();
|
const info = (await this.whatsappNumber({ numbers: [jid] }))?.shift();
|
||||||
const picture = await this.profilePicture(jid);
|
const picture = await this.profilePicture(info?.jid);
|
||||||
const status = await this.getStatus(jid);
|
const status = await this.getStatus(info?.jid);
|
||||||
|
const business = await this.fetchBusinessProfile(info?.jid);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
wuid: jid,
|
wuid: info?.jid || jid,
|
||||||
name: info?.name,
|
name: info?.name,
|
||||||
numberExists: info?.exists,
|
numberExists: info?.exists,
|
||||||
picture: picture?.profilePictureUrl,
|
picture: picture?.profilePictureUrl,
|
||||||
@ -1484,6 +1483,7 @@ export class WAStartupService {
|
|||||||
};
|
};
|
||||||
} else {
|
} else {
|
||||||
const info = await waMonitor.instanceInfo(instanceName);
|
const info = await waMonitor.instanceInfo(instanceName);
|
||||||
|
const business = await this.fetchBusinessProfile(jid);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
wuid: jid,
|
wuid: jid,
|
||||||
@ -1497,7 +1497,6 @@ export class WAStartupService {
|
|||||||
website: business?.website?.shift(),
|
website: business?.website?.shift(),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
this.logger.verbose('Profile not found');
|
this.logger.verbose('Profile not found');
|
||||||
return {
|
return {
|
||||||
|
Loading…
Reference in New Issue
Block a user