Skip to content

Commit

Permalink
Merge pull request #371 from judsonjuniorr/develop
Browse files Browse the repository at this point in the history
Add number parameter to OnWhatsAppDto constructor
  • Loading branch information
DavidsonGomes authored Jan 21, 2024
2 parents 69a3236 + 440ff2f commit 391ffea
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
7 changes: 6 additions & 1 deletion src/whatsapp/dto/chat.dto.ts
Original file line number Diff line number Diff line change
@@ -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 {
Expand Down
8 changes: 4 additions & 4 deletions src/whatsapp/services/whatsapp.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3137,19 +3137,19 @@ 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);

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));
}
}
}
Expand Down

0 comments on commit 391ffea

Please sign in to comment.