Skip to content

Commit 670908f

Browse files
authored
Update whatsapp.baileys.service.ts
1 parent 4ead57f commit 670908f

1 file changed

Lines changed: 37 additions & 34 deletions

File tree

src/api/integrations/channel/whatsapp/whatsapp.baileys.service.ts

Lines changed: 37 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -507,40 +507,43 @@ export class BaileysStartupService extends ChannelStartupService {
507507
}
508508

509509
private async getMessage(key: proto.IMessageKey, full = false) {
510-
try {
511-
const webMessageInfo = (await this.prismaRepository.message.findMany({
512-
where: {
513-
instanceId: this.instanceId,
514-
key: {
515-
path: ['id'],
516-
equals: key.id,
517-
},
518-
},
519-
})) as unknown as proto.IWebMessageInfo[];
520-
if (full) {
521-
return webMessageInfo[0];
522-
}
523-
524-
525-
if (webMessageInfo[0].message?.pollCreationMessage) {
526-
const messageSecretBase64 = webMessageInfo[0].message?.messageContextInfo?.messageSecret;
527-
528-
if (typeof messageSecretBase64 === 'string') {
529-
const messageSecret = Buffer.from(messageSecretBase64, 'base64');
530-
531-
const msg = {
532-
messageContextInfo: {
533-
messageSecret,
534-
},
535-
pollCreationMessage: webMessageInfo[0].message?.pollCreationMessage,
536-
};
537-
538-
return msg;
539-
}
540-
541-
}
542-
543-
return webMessageInfo[0].message;
510+
// try {
511+
// const webMessageInfo = (await this.prismaRepository.message.findMany({
512+
// where: {
513+
// instanceId: this.instanceId,
514+
// key: {
515+
// path: ['id'],
516+
// equals: key.id,
517+
// },
518+
// },
519+
// })) as unknown as proto.IWebMessageInfo[];
520+
521+
// console.log()
522+
// if (full) {
523+
// return webMessageInfo[0];
524+
// }
525+
526+
527+
// if (webMessageInfo[0].message?.pollCreationMessage) {
528+
// const messageSecretBase64 = webMessageInfo[0].message?.messageContextInfo?.messageSecret;
529+
530+
// if (typeof messageSecretBase64 === 'string') {
531+
// const messageSecret = Buffer.from(messageSecretBase64, 'base64');
532+
533+
// const msg = {
534+
// messageContextInfo: {
535+
// messageSecret,
536+
// },
537+
// pollCreationMessage: webMessageInfo[0].message?.pollCreationMessage,
538+
// };
539+
540+
// return msg;
541+
// }
542+
543+
// }
544+
545+
// return webMessageInfo[0].message;
546+
return null
544547
} catch (error) {
545548
return null
546549
// return { conversation: '' };

0 commit comments

Comments
 (0)