mirror of
https://github.com/cheveguerra/bot-whatsapp.git
synced 2026-04-20 12:39:24 +00:00
fix(contexts): 🔥 added buttons
fix(contexts): 🔥 added buttons
This commit is contained in:
@@ -96,12 +96,24 @@ class DialogFlowCXContext extends CoreClass {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (res.message == 'payload') {
|
if (res.message == 'payload') {
|
||||||
const { values } = res.payload.fields.buttons.listValue
|
const {
|
||||||
const buttonsArray = values.map((values) => {
|
media = null,
|
||||||
const { stringValue } = values.structValue.fields.body
|
buttons = [],
|
||||||
return { body: stringValue }
|
answer = '',
|
||||||
})
|
} = res.payload.fields
|
||||||
return { buttons: buttonsArray }
|
const buttonsArray = buttons?.listValue?.values?.map(
|
||||||
|
(btnValue) => {
|
||||||
|
const { stringValue } = btnValue.structValue.fields.body
|
||||||
|
return { body: stringValue }
|
||||||
|
}
|
||||||
|
)
|
||||||
|
return {
|
||||||
|
answer: answer?.stringValue,
|
||||||
|
options: {
|
||||||
|
media: media?.stringValue,
|
||||||
|
buttons: buttonsArray,
|
||||||
|
},
|
||||||
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
@@ -93,8 +93,9 @@ class DialogFlowContext extends CoreClass {
|
|||||||
if (msgPayload && msgPayload?.payload) {
|
if (msgPayload && msgPayload?.payload) {
|
||||||
const { fields } = msgPayload.payload
|
const { fields } = msgPayload.payload
|
||||||
const mapButtons = fields?.buttons?.listValue?.values.map((m) => {
|
const mapButtons = fields?.buttons?.listValue?.values.map((m) => {
|
||||||
return m?.structValue?.fields?.body?.stringValue
|
return { body: m?.structValue?.fields?.body?.stringValue }
|
||||||
})
|
})
|
||||||
|
|
||||||
customPayload = {
|
customPayload = {
|
||||||
media: fields?.media?.stringValue,
|
media: fields?.media?.stringValue,
|
||||||
buttons: mapButtons,
|
buttons: mapButtons,
|
||||||
|
|||||||
Reference in New Issue
Block a user