Skip to content

Commit cd0da91

Browse files
Merge pull request #96 from moskoweb/fetch-profile
Get Info JID Correct
2 parents 7a7e728 + c154205 commit cd0da91

1 file changed

Lines changed: 8 additions & 7 deletions

File tree

src/whatsapp/services/whatsapp.service.ts

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1900,19 +1900,19 @@ export class WAStartupService {
19001900

19011901
public async fetchProfile(instanceName: string, number?: string) {
19021902
const jid = number ? this.createJid(number) : this.client?.user?.id;
1903-
1903+
19041904
this.logger.verbose('Getting profile with jid: ' + jid);
19051905
try {
19061906
this.logger.verbose('Getting profile info');
1907-
const business = await this.fetchBusinessProfile(jid);
1908-
1907+
19091908
if (number) {
19101909
const info = (await this.whatsappNumber({ numbers: [jid] }))?.shift();
1911-
const picture = await this.profilePicture(jid);
1912-
const status = await this.getStatus(jid);
1913-
1910+
const picture = await this.profilePicture(info?.jid);
1911+
const status = await this.getStatus(info?.jid);
1912+
const business = await this.fetchBusinessProfile(info?.jid);
1913+
19141914
return {
1915-
wuid: jid,
1915+
wuid: info?.jid || jid,
19161916
name: info?.name,
19171917
numberExists: info?.exists,
19181918
picture: picture?.profilePictureUrl,
@@ -1924,6 +1924,7 @@ export class WAStartupService {
19241924
};
19251925
} else {
19261926
const info = await waMonitor.instanceInfo(instanceName);
1927+
const business = await this.fetchBusinessProfile(jid);
19271928

19281929
return {
19291930
wuid: jid,

0 commit comments

Comments
 (0)