Skip to content

Commit 2ea79e9

Browse files
committed
fix: add lid
1 parent e335821 commit 2ea79e9

1 file changed

Lines changed: 6 additions & 5 deletions

File tree

src/whatsapp/services/whatsapp.service.ts

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -644,7 +644,7 @@ export class WAStartupService {
644644
},
645645
})
646646
.then((result) => {
647-
if (result?.id) {
647+
if (result && result.id) {
648648
this.repository.chat
649649
.update({
650650
where: {
@@ -813,7 +813,7 @@ export class WAStartupService {
813813

814814
messagesRaw.push({
815815
keyId: m.key.id,
816-
keyRemoteJid: m.key.remoteJid,
816+
keyRemoteJid: m.key?.remoteJid || m.key?.['lid'],
817817
keyFromMe: m.key.fromMe,
818818
pushName: m?.pushName || m.key.remoteJid.split('@')[0],
819819
keyParticipant: m?.participant || m.key?.participant,
@@ -844,6 +844,7 @@ export class WAStartupService {
844844
}) => {
845845
for (const received of messages) {
846846
if (!received?.message) {
847+
await this.client.waitForMessage(received.key.id)
847848
continue;
848849
}
849850

@@ -863,7 +864,7 @@ export class WAStartupService {
863864

864865
const messageRaw = {
865866
keyId: received.key.id,
866-
keyRemoteJid: received.key.remoteJid,
867+
keyRemoteJid: received.key?.remoteJid || received?.key?.['lid'],
867868
keyFromMe: received.key.fromMe,
868869
pushName: received.pushName,
869870
keyParticipant: received?.participant || received.key?.participant,
@@ -1171,7 +1172,7 @@ export class WAStartupService {
11711172
}
11721173

11731174
private createJid(number: string): string {
1174-
if (number.includes('@g.us') || number.includes('@s.whatsapp.net')) {
1175+
if (number.includes('@g.us') || number.includes('@s.whatsapp.net') || number.includes('@lid')) {
11751176
return number;
11761177
}
11771178

@@ -1327,7 +1328,7 @@ export class WAStartupService {
13271328
return {
13281329
keyId: m.key.id,
13291330
keyFromMe: m.key.fromMe,
1330-
keyRemoteJid: m.key.remoteJid,
1331+
keyRemoteJid: m.key?.remoteJid || m.key?.['lid'],
13311332
keyParticipant: m?.participant,
13321333
pushName: m?.pushName,
13331334
messageType: getContentType(m.message),

0 commit comments

Comments
 (0)