@@ -1458,21 +1458,20 @@ export class WAStartupService {
14581458 }
14591459
14601460 public async fetchProfile ( instanceName : string , number ?: string ) {
1461- const jid = ( number )
1462- ? this . createJid ( number )
1463- : this . client ?. user ?. id ;
1461+ const jid = number ? this . createJid ( number ) : this . client ?. user ?. id ;
1462+
14641463 this . logger . verbose ( 'Getting profile with jid: ' + jid ) ;
14651464 try {
14661465 this . logger . verbose ( 'Getting profile info' ) ;
1467- const business = await this . fetchBusinessProfile ( jid ) ;
1468-
1466+
14691467 if ( number ) {
14701468 const info = ( await this . whatsappNumber ( { numbers : [ jid ] } ) ) ?. shift ( ) ;
1471- const picture = await this . profilePicture ( jid ) ;
1472- const status = await this . getStatus ( jid ) ;
1473-
1469+ const picture = await this . profilePicture ( info ?. jid ) ;
1470+ const status = await this . getStatus ( info ?. jid ) ;
1471+ const business = await this . fetchBusinessProfile ( info ?. jid ) ;
1472+
14741473 return {
1475- wuid : jid ,
1474+ wuid : info ?. jid || jid ,
14761475 name : info ?. name ,
14771476 numberExists : info ?. exists ,
14781477 picture : picture ?. profilePictureUrl ,
@@ -1484,7 +1483,8 @@ export class WAStartupService {
14841483 } ;
14851484 } else {
14861485 const info = await waMonitor . instanceInfo ( instanceName ) ;
1487-
1486+ const business = await this . fetchBusinessProfile ( jid ) ;
1487+
14881488 return {
14891489 wuid : jid ,
14901490 name : info ?. instance ?. profileName ,
@@ -1497,7 +1497,6 @@ export class WAStartupService {
14971497 website : business ?. website ?. shift ( ) ,
14981498 } ;
14991499 }
1500-
15011500 } catch ( error ) {
15021501 this . logger . verbose ( 'Profile not found' ) ;
15031502 return {
0 commit comments