mirror of
https://github.com/cheveguerra/whatsapp-web.js.git
synced 2026-04-20 04:29:15 +00:00
Fix buttons sending (#1655)
* Fix buttons sending * Quick reply id must be a string * Update src/util/Injected.js * Update src/structures/Buttons.js Co-authored-by: Rajeh Taher <rajeh@reforward.dev>
This commit is contained in:
@@ -98,7 +98,7 @@ class Buttons {
|
|||||||
index,
|
index,
|
||||||
quickReplyButton: {
|
quickReplyButton: {
|
||||||
displayText: button.body,
|
displayText: button.body,
|
||||||
id: button.id || index
|
id: button.id || `${index}`
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -222,6 +222,14 @@ exports.ExposeStore = (moduleRaidStr) => {
|
|||||||
};
|
};
|
||||||
delete proto.templateMessage;
|
delete proto.templateMessage;
|
||||||
}
|
}
|
||||||
|
if (proto.buttonsMessage) {
|
||||||
|
proto.viewOnceMessage = {
|
||||||
|
message: {
|
||||||
|
buttonsMessage: proto.buttonsMessage,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
delete proto.buttonsMessage;
|
||||||
|
}
|
||||||
if (proto.listMessage) {
|
if (proto.listMessage) {
|
||||||
proto.viewOnceMessage = {
|
proto.viewOnceMessage = {
|
||||||
message: {
|
message: {
|
||||||
@@ -348,7 +356,6 @@ exports.LoadUtils = () => {
|
|||||||
|
|
||||||
window.WWebJS.prepareMessageButtons = (buttonsOptions) => {
|
window.WWebJS.prepareMessageButtons = (buttonsOptions) => {
|
||||||
const returnObject = {};
|
const returnObject = {};
|
||||||
|
|
||||||
if (!buttonsOptions.buttons) {
|
if (!buttonsOptions.buttons) {
|
||||||
return returnObject;
|
return returnObject;
|
||||||
}
|
}
|
||||||
@@ -397,7 +404,7 @@ exports.LoadUtils = () => {
|
|||||||
returnObject.isDynamicReplyButtonsMsg = true;
|
returnObject.isDynamicReplyButtonsMsg = true;
|
||||||
|
|
||||||
returnObject.dynamicReplyButtons = buttonsOptions.buttons.map((button, index) => ({
|
returnObject.dynamicReplyButtons = buttonsOptions.buttons.map((button, index) => ({
|
||||||
buttonId: button.index || `${index}`,
|
buttonId: button.quickReplyButton.id.toString() || `${index}`,
|
||||||
buttonText: {displayText: button.quickReplyButton?.displayText},
|
buttonText: {displayText: button.quickReplyButton?.displayText},
|
||||||
type: 1,
|
type: 1,
|
||||||
}));
|
}));
|
||||||
|
|||||||
Reference in New Issue
Block a user