Merge pull request #96 from moskoweb/fetch-profile

Get Info JID Correct
This commit is contained in:
Davidson Gomes 2023-09-05 21:42:21 -03:00 committed by GitHub
commit cd0da914f4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1900,19 +1900,19 @@ export class WAStartupService {
public async fetchProfile(instanceName: string, number?: string) {
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,
@ -1924,6 +1924,7 @@ export class WAStartupService {
};
} else {
const info = await waMonitor.instanceInfo(instanceName);
const business = await this.fetchBusinessProfile(jid);
return {
wuid: jid,