mirror of
https://github.com/cheveguerra/bot-whatsapp.git
synced 2026-04-18 03:29:15 +00:00
fix(bot): 🚑 fix callback functions
This commit is contained in:
@@ -92,14 +92,25 @@ class CoreClass {
|
||||
return refToContinue
|
||||
}
|
||||
|
||||
// 📄 [options: callback]: Si se tiene un callback se ejecuta
|
||||
if (!fallBackFlag && refToContinue && prevMsg?.options?.callback) {
|
||||
const indexFlow = this.flowClass.findIndexByRef(refToContinue?.ref)
|
||||
// 📄 Se encarga de revisar si el contexto del mensaje tiene callback y ejecutarlo
|
||||
const cbEveryCtx = (inRef) => {
|
||||
const indexFlow = this.flowClass.findIndexByRef(inRef)
|
||||
this.flowClass.allCallbacks[indexFlow].callback(messageInComming, {
|
||||
fallBack,
|
||||
})
|
||||
}
|
||||
|
||||
// 📄 [options: callback]: Si se tiene un callback se ejecuta
|
||||
if (!fallBackFlag) {
|
||||
if (refToContinue && prevMsg?.options?.callback) {
|
||||
cbEveryCtx(refToContinue?.ref)
|
||||
} else {
|
||||
for (const ite of this.flowClass.find(body)) {
|
||||
cbEveryCtx(ite?.ref)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 📄🤘(tiene return) [options: nested(array)]: Si se tiene flujos hijos los implementa
|
||||
if (!fallBackFlag && prevMsg?.options?.nested?.length) {
|
||||
const nestedRef = prevMsg.options.nested
|
||||
|
||||
Reference in New Issue
Block a user