diff --git a/src/Client.js b/src/Client.js index 3d8de39..b09c2f3 100644 --- a/src/Client.js +++ b/src/Client.js @@ -540,7 +540,7 @@ class Client extends EventEmitter { quotedMessageId: options.quotedMessageId, parseVCards: options.parseVCards === false ? false : true, mentionedJidList: Array.isArray(options.mentions) ? options.mentions.map(contact => contact.id._serialized) : [], - ...options.extra + extraOptions: options.extra }; const sendSeen = typeof options.sendSeen === 'undefined' ? true : options.sendSeen; diff --git a/src/util/Injected.js b/src/util/Injected.js index 06b7049..fe0f9c8 100644 --- a/src/util/Injected.js +++ b/src/util/Injected.js @@ -153,7 +153,7 @@ exports.LoadUtils = () => { } } - let extraOptions = {}; + let buttonOptions = {}; if(options.buttons){ let caption; if(options.buttons.type === 'chat') { @@ -162,7 +162,7 @@ exports.LoadUtils = () => { }else{ caption = options.caption ? options.caption : ' '; //Caption can't be empty } - extraOptions = { + buttonOptions = { productHeaderImageRejected: false, isFromTemplate: false, isDynamicReplyButtonsMsg: true, @@ -175,12 +175,12 @@ exports.LoadUtils = () => { delete options.buttons; } + let listOptions = {}; if(options.list){ if(window.Store.Conn.platform === 'smba' || window.Store.Conn.platform === 'smbi'){ throw '[LT01] Whatsapp business can\'t send this yet'; } - extraOptions = { - ...extraOptions, + listOptions = { type: 'list', footer: options.list.footer, list: { @@ -190,7 +190,7 @@ exports.LoadUtils = () => { body: options.list.description }; delete options.list; - delete extraOptions.list.footer; + delete listOptions.list.footer; } const newMsgId = new window.Store.MsgKey({ @@ -199,6 +199,9 @@ exports.LoadUtils = () => { id: window.Store.genId(), }); + const extraOptions = options.extraOptions || {}; + delete options.extraOptions; + const message = { ...options, id: newMsgId, @@ -215,6 +218,8 @@ exports.LoadUtils = () => { ...attOptions, ...quotedMsgOptions, ...vcardOptions, + ...buttonOptions, + ...listOptions, ...extraOptions };