From 1662904aabb1f58e247c5f74d46b15b609a1dde9 Mon Sep 17 00:00:00 2001 From: Leandro Rocha Date: Wed, 8 Jan 2025 19:49:35 -0300 Subject: [PATCH] fix: error TS2339: Property 'status' does not exist on type 'USyncQueryResultList[]' --- .../channel/whatsapp/whatsapp.baileys.service.ts | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/api/integrations/channel/whatsapp/whatsapp.baileys.service.ts b/src/api/integrations/channel/whatsapp/whatsapp.baileys.service.ts index 0afd5318..3552d243 100644 --- a/src/api/integrations/channel/whatsapp/whatsapp.baileys.service.ts +++ b/src/api/integrations/channel/whatsapp/whatsapp.baileys.service.ts @@ -270,7 +270,7 @@ export class BaileysStartupService extends ChannelStartupService { public async getProfileStatus() { const status = await this.client.fetchStatus(this.instance.wuid); - return status?.status; + return status[0]?.status; } public get profilePictureUrl() { @@ -1785,7 +1785,7 @@ export class BaileysStartupService extends ChannelStartupService { try { return { wuid: jid, - status: (await this.client.fetchStatus(jid))?.status, + status: (await this.client.fetchStatus(jid))[0]?.status, }; } catch (error) { return { @@ -1808,7 +1808,8 @@ export class BaileysStartupService extends ChannelStartupService { if (number) { const info = (await this.whatsappNumber({ numbers: [jid] }))?.shift(); const picture = await this.profilePicture(info?.jid); - const status = await this.getStatus(info?.jid); + const statusResult = await this.getStatus(info?.jid); + const status = Array.isArray(statusResult) && statusResult.length > 0 ? statusResult[0]?.status : null; const business = await this.fetchBusinessProfile(info?.jid); return { @@ -1816,7 +1817,7 @@ export class BaileysStartupService extends ChannelStartupService { name: info?.name, numberExists: info?.exists, picture: picture?.profilePictureUrl, - status: status?.status, + status: status, isBusiness: business.isBusiness, email: business?.email, description: business?.description,