fix: error TS2339: Property 'status' does not exist on type 'USyncQueryResultList[]'

This commit is contained in:
Leandro Rocha 2025-01-08 19:49:35 -03:00
parent 1665654676
commit 1662904aab

View File

@ -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,