From 440ff2f3eac85e5c8dbd2fc50f7d9ca0882eca84 Mon Sep 17 00:00:00 2001 From: Judson Junior Date: Sat, 20 Jan 2024 11:44:10 -0300 Subject: [PATCH] Add number parameter to OnWhatsAppDto constructor --- src/whatsapp/dto/chat.dto.ts | 7 ++++++- src/whatsapp/services/whatsapp.service.ts | 8 ++++---- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/src/whatsapp/dto/chat.dto.ts b/src/whatsapp/dto/chat.dto.ts index efa74db8..dc0584bb 100644 --- a/src/whatsapp/dto/chat.dto.ts +++ b/src/whatsapp/dto/chat.dto.ts @@ -1,7 +1,12 @@ import { proto, WAPresence, WAPrivacyOnlineValue, WAPrivacyValue, WAReadReceiptsValue } from '@whiskeysockets/baileys'; export class OnWhatsAppDto { - constructor(public readonly jid: string, public readonly exists: boolean, public readonly name?: string) {} + constructor( + public readonly jid: string, + public readonly exists: boolean, + public readonly number: string, + public readonly name?: string, + ) {} } export class getBase64FromMediaMessageDto { diff --git a/src/whatsapp/services/whatsapp.service.ts b/src/whatsapp/services/whatsapp.service.ts index c49df6bf..80ac7397 100644 --- a/src/whatsapp/services/whatsapp.service.ts +++ b/src/whatsapp/services/whatsapp.service.ts @@ -3137,9 +3137,9 @@ export class WAStartupService { if (!group) throw new BadRequestException('Group not found'); - onWhatsapp.push(new OnWhatsAppDto(group.id, !!group?.id, group?.subject)); + onWhatsapp.push(new OnWhatsAppDto(group.id, !!group?.id, number, group?.subject)); } else if (jid === 'status@broadcast') { - onWhatsapp.push(new OnWhatsAppDto(jid, false)); + onWhatsapp.push(new OnWhatsAppDto(jid, false, number)); } else { jid = !jid.startsWith('+') ? `+${jid}` : jid; const verify = await this.client.onWhatsApp(jid); @@ -3147,9 +3147,9 @@ export class WAStartupService { const result = verify[0]; if (!result) { - onWhatsapp.push(new OnWhatsAppDto(jid, false)); + onWhatsapp.push(new OnWhatsAppDto(jid, false, number)); } else { - onWhatsapp.push(new OnWhatsAppDto(result.jid, result.exists)); + onWhatsapp.push(new OnWhatsAppDto(result.jid, result.exists, number)); } } }