mirror of
https://github.com/EvolutionAPI/evolution-api.git
synced 2025-07-19 05:21:56 -06:00
Merge pull request #96 from moskoweb/fetch-profile
Get Info JID Correct
This commit is contained in:
commit
cd0da914f4
@ -1900,19 +1900,19 @@ export class WAStartupService {
|
|||||||
|
|
||||||
public async fetchProfile(instanceName: string, number?: string) {
|
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);
|
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,
|
||||||
@ -1924,6 +1924,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,
|
||||||
|
Loading…
Reference in New Issue
Block a user