mirror of
https://github.com/cheveguerra/whatsapp-web.js.git
synced 2026-04-18 03:29:14 +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,
|
||||
quickReplyButton: {
|
||||
displayText: button.body,
|
||||
id: button.id || index
|
||||
id: button.id || `${index}`
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@@ -222,6 +222,14 @@ exports.ExposeStore = (moduleRaidStr) => {
|
||||
};
|
||||
delete proto.templateMessage;
|
||||
}
|
||||
if (proto.buttonsMessage) {
|
||||
proto.viewOnceMessage = {
|
||||
message: {
|
||||
buttonsMessage: proto.buttonsMessage,
|
||||
},
|
||||
};
|
||||
delete proto.buttonsMessage;
|
||||
}
|
||||
if (proto.listMessage) {
|
||||
proto.viewOnceMessage = {
|
||||
message: {
|
||||
@@ -348,7 +356,6 @@ exports.LoadUtils = () => {
|
||||
|
||||
window.WWebJS.prepareMessageButtons = (buttonsOptions) => {
|
||||
const returnObject = {};
|
||||
|
||||
if (!buttonsOptions.buttons) {
|
||||
return returnObject;
|
||||
}
|
||||
@@ -397,7 +404,7 @@ exports.LoadUtils = () => {
|
||||
returnObject.isDynamicReplyButtonsMsg = true;
|
||||
|
||||
returnObject.dynamicReplyButtons = buttonsOptions.buttons.map((button, index) => ({
|
||||
buttonId: button.index || `${index}`,
|
||||
buttonId: button.quickReplyButton.id.toString() || `${index}`,
|
||||
buttonText: {displayText: button.quickReplyButton?.displayText},
|
||||
type: 1,
|
||||
}));
|
||||
|
||||
Reference in New Issue
Block a user