mirror of
https://github.com/cheveguerra/bot-whatsapp.git
synced 2026-04-20 12:39:24 +00:00
fix(contexts): 🐛 fixed #524 issue
This commit is contained in:
@@ -212,5 +212,24 @@ class CoreClass {
|
|||||||
this.continue(null, responde.ref)
|
this.continue(null, responde.ref)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Funcion dedicada a enviar el mensaje sin pasar por el flow
|
||||||
|
* (dialogflow)
|
||||||
|
* @param {*} messageToSend
|
||||||
|
* @param {*} numberOrId
|
||||||
|
* @returns
|
||||||
|
*/
|
||||||
|
sendFlowSimple = async (messageToSend, numberOrId) => {
|
||||||
|
const queue = []
|
||||||
|
for (const ctxMessage of messageToSend) {
|
||||||
|
const delayMs = ctxMessage?.options?.delay || 0
|
||||||
|
if (delayMs) await delay(delayMs)
|
||||||
|
QueuePrincipal.enqueue(() =>
|
||||||
|
this.sendProviderAndSave(numberOrId, ctxMessage)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
return Promise.all(queue)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
module.exports = CoreClass
|
module.exports = CoreClass
|
||||||
|
|||||||
@@ -117,7 +117,7 @@ class DialogFlowCXContext extends CoreClass {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
this.sendFlow(listMessages, from)
|
this.sendFlowSimple(listMessages, from)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -107,7 +107,7 @@ class DialogFlowContext extends CoreClass {
|
|||||||
...customPayload,
|
...customPayload,
|
||||||
answer: fields?.answer?.stringValue,
|
answer: fields?.answer?.stringValue,
|
||||||
}
|
}
|
||||||
this.sendFlow([ctxFromDX], from)
|
this.sendFlowSimple([ctxFromDX], from)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -115,7 +115,7 @@ class DialogFlowContext extends CoreClass {
|
|||||||
answer: queryResult?.fulfillmentText,
|
answer: queryResult?.fulfillmentText,
|
||||||
}
|
}
|
||||||
|
|
||||||
this.sendFlow([ctxFromDX], from)
|
this.sendFlowSimple([ctxFromDX], from)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user