mirror of
https://github.com/EvolutionAPI/evolution-api.git
synced 2025-07-23 04:22:02 -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) {
|
||||
const jid = (number)
|
||||
? this.createJid(number)
|
||||
: this.client?.user?.id;
|
||||
const jid = number ? this.createJid(number) : this.client?.user?.id;
|
||||
|
||||
this.logger.verbose('Getting profile with jid: ' + jid);
|
||||
try {
|
||||
this.logger.verbose('Getting profile info');
|
||||
const business = await this.fetchBusinessProfile(jid);
|
||||
|
||||
if (number) {
|
||||
const info = (await this.whatsappNumber({ numbers: [jid] }))?.shift();
|
||||
const picture = await this.profilePicture(jid);
|
||||
const status = await this.getStatus(jid);
|
||||
const picture = await this.profilePicture(info?.jid);
|
||||
const status = await this.getStatus(info?.jid);
|
||||
const business = await this.fetchBusinessProfile(info?.jid);
|
||||
|
||||
return {
|
||||
wuid: jid,
|
||||
wuid: info?.jid || jid,
|
||||
name: info?.name,
|
||||
numberExists: info?.exists,
|
||||
picture: picture?.profilePictureUrl,
|
||||
@ -1484,6 +1483,7 @@ export class WAStartupService {
|
||||
};
|
||||
} else {
|
||||
const info = await waMonitor.instanceInfo(instanceName);
|
||||
const business = await this.fetchBusinessProfile(jid);
|
||||
|
||||
return {
|
||||
wuid: jid,
|
||||
@ -1497,7 +1497,6 @@ export class WAStartupService {
|
||||
website: business?.website?.shift(),
|
||||
};
|
||||
}
|
||||
|
||||
} catch (error) {
|
||||
this.logger.verbose('Profile not found');
|
||||
return {
|
||||
|
Loading…
Reference in New Issue
Block a user