Merge pull request #371 from judsonjuniorr/develop

Add number parameter to OnWhatsAppDto constructor
This commit is contained in:
Davidson Gomes 2024-01-21 18:12:31 -03:00 committed by GitHub
commit 391ffea4ab
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 10 additions and 5 deletions

View File

@ -1,7 +1,12 @@
import { proto, WAPresence, WAPrivacyOnlineValue, WAPrivacyValue, WAReadReceiptsValue } from '@whiskeysockets/baileys'; import { proto, WAPresence, WAPrivacyOnlineValue, WAPrivacyValue, WAReadReceiptsValue } from '@whiskeysockets/baileys';
export class OnWhatsAppDto { 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 { export class getBase64FromMediaMessageDto {

View File

@ -3137,9 +3137,9 @@ export class WAStartupService {
if (!group) throw new BadRequestException('Group not found'); 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') { } else if (jid === 'status@broadcast') {
onWhatsapp.push(new OnWhatsAppDto(jid, false)); onWhatsapp.push(new OnWhatsAppDto(jid, false, number));
} else { } else {
jid = !jid.startsWith('+') ? `+${jid}` : jid; jid = !jid.startsWith('+') ? `+${jid}` : jid;
const verify = await this.client.onWhatsApp(jid); const verify = await this.client.onWhatsApp(jid);
@ -3147,9 +3147,9 @@ export class WAStartupService {
const result = verify[0]; const result = verify[0];
if (!result) { if (!result) {
onWhatsapp.push(new OnWhatsAppDto(jid, false)); onWhatsapp.push(new OnWhatsAppDto(jid, false, number));
} else { } else {
onWhatsapp.push(new OnWhatsAppDto(result.jid, result.exists)); onWhatsapp.push(new OnWhatsAppDto(result.jid, result.exists, number));
} }
} }
} }