Skip to content

Commit

Permalink
fix: Fixed list for latest WhatsApp (2.22.16.75) (fix #571)
Browse files Browse the repository at this point in the history
  • Loading branch information
edgardmessias committed Aug 4, 2022
1 parent abfc9ad commit 4cae69e
Showing 1 changed file with 21 additions and 1 deletion.
22 changes: 21 additions & 1 deletion src/chat/functions/sendListMessage.ts
Expand Up @@ -17,7 +17,10 @@
import { WPPError } from '../../util';
import * as webpack from '../../webpack';
import { wrapModuleFunction } from '../../whatsapp/exportModule';
import { typeAttributeFromProtobuf } from '../../whatsapp/functions';
import {
createMsgProtobuf,
typeAttributeFromProtobuf,
} from '../../whatsapp/functions';
import {
defaultSendMessageOptions,
RawMessage,
Expand Down Expand Up @@ -115,4 +118,21 @@ webpack.onInjected(() => {
}
return func(...args);
});

// Delayed register to ensure is after the common protobuf
setTimeout(() => {
wrapModuleFunction(createMsgProtobuf, (func, ...args) => {
const proto = func(...args);

if (proto.listMessage) {
proto.viewOnceMessage = {
message: {
listMessage: proto.listMessage,
},
};
delete proto.listMessage;
}
return proto;
});
}, 100);
});

0 comments on commit 4cae69e

Please sign in to comment.