Skip to content

Commit

Permalink
fix: Fixed buttons/list messages (fix #1024, fix #977)
Browse files Browse the repository at this point in the history
  • Loading branch information
edgardmessias committed Apr 3, 2023
1 parent 7b10c2c commit 8c91d3f
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 57 deletions.
34 changes: 1 addition & 33 deletions src/chat/functions/prepareMessageButtons.ts
Expand Up @@ -286,34 +286,6 @@ webpack.onInjected(() => {
return r;
});

/**
* Delayed register to ensure is after the common protobuf
* Based on https://github.com/adiwajshing/Baileys/commit/9f3b00d58d4f6b1527db42069acafff01123cbf8
*/
setTimeout(() => {
wrapModuleFunction(createMsgProtobuf, (func, ...args) => {
const proto = func(...args);

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

wrapModuleFunction(encodeMaybeMediaType, (func, ...args) => {
const [type] = args;
if (type === 'button') {
Expand Down Expand Up @@ -388,11 +360,7 @@ webpack.onInjected(() => {
let bizNode = content.find((c) => c.tag === 'biz');

if (!bizNode) {
bizNode = websocket.smax(
'biz',
{ native_flow_name: 'wa_payment_learn_more' },
null
);
bizNode = websocket.smax('biz', {}, null);
content.push(bizNode);
}

Expand Down
25 changes: 1 addition & 24 deletions src/chat/functions/sendListMessage.ts
Expand Up @@ -17,10 +17,7 @@
import { WPPError } from '../../util';
import * as webpack from '../../webpack';
import { wrapModuleFunction } from '../../whatsapp/exportModule';
import {
createMsgProtobuf,
typeAttributeFromProtobuf,
} from '../../whatsapp/functions';
import { typeAttributeFromProtobuf } from '../../whatsapp/functions';
import {
defaultSendMessageOptions,
RawMessage,
Expand Down Expand Up @@ -118,24 +115,4 @@ webpack.onInjected(() => {
}
return func(...args);
});

/**
* Delayed register to ensure is after the common protobuf
* Based on https://github.com/adiwajshing/Baileys/commit/9f3b00d58d4f6b1527db42069acafff01123cbf8
*/
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 8c91d3f

Please sign in to comment.