Skip to content

Commit

Permalink
clear messages for me
Browse files Browse the repository at this point in the history
  • Loading branch information
jrCleber committed Sep 9, 2024
1 parent ea7f4dd commit e2543bd
Showing 1 changed file with 17 additions and 35 deletions.
52 changes: 17 additions & 35 deletions src/whatsapp/services/whatsapp.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -535,25 +535,6 @@ export class WAStartupService {
syncFullHistory: true,
userDevicesCache: this.userDevicesCache,
transactionOpts: { maxCommitRetries: 5, delayBetweenTriesMs: 50 },
patchMessageBeforeSending(message) {
if (
message.deviceSentMessage?.message?.listMessage?.listType ===
proto.Message.ListMessage.ListType.PRODUCT_LIST
) {
message = JSON.parse(JSON.stringify(message));
message.deviceSentMessage.message.listMessage.listType =
proto.Message.ListMessage.ListType.SINGLE_SELECT;
}

if (
message.listMessage?.listType == proto.Message.ListMessage.ListType.PRODUCT_LIST
) {
message = JSON.parse(JSON.stringify(message));
message.listMessage.listType = proto.Message.ListMessage.ListType.SINGLE_SELECT;
}

return message;
},
};

return makeWASocket(socketConfig);
Expand Down Expand Up @@ -1721,13 +1702,17 @@ export class WAStartupService {
public async listLegacy(data: SendListLegacyDto) {
const msg = data.listMessage;
return await this.sendMessageWithTyping(data.number, {
listMessage: {
title: msg.title,
description: msg?.description,
footerText: msg?.footer,
buttonText: msg.buttonText,
sections: msg.sections,
listType: proto.Message.ListMessage.ListType.SINGLE_SELECT,
viewOnceMessageV2: {
message: {
listMessage: {
title: msg.title,
description: msg?.description,
footerText: msg?.footer,
buttonText: msg.buttonText,
sections: msg.sections,
listType: proto.Message.ListMessage.ListType.SINGLE_SELECT,
},
},
},
});
}
Expand Down Expand Up @@ -1876,18 +1861,15 @@ export class WAStartupService {
if (!everyOne) {
await this.client.chatModify(
{
delete: false as any,
lastMessages: [
{
key: {
clear: {
messages: [
{
id: message.keyId,
fromMe: message.keyFromMe,
participant: message?.keyParticipant,
remoteJid: message.keyRemoteJid,
timestamp: message.messageTimestamp,
},
messageTimestamp: message.messageTimestamp,
},
],
],
},
},
message.keyRemoteJid,
);
Expand Down

0 comments on commit e2543bd

Please sign in to comment.