mirror of
https://github.com/cheveguerra/bot-whatsapp.git
synced 2026-04-20 04:29:16 +00:00
fix(cli): ⚡ working flowDynamic test
This commit is contained in:
@@ -168,16 +168,25 @@ class CoreClass {
|
|||||||
const parseListMsg = listMsg.map((opt, index) => createCtxMessage(opt, index))
|
const parseListMsg = listMsg.map((opt, index) => createCtxMessage(opt, index))
|
||||||
const currentPrev = await this.databaseClass.getPrevByNumber(from)
|
const currentPrev = await this.databaseClass.getPrevByNumber(from)
|
||||||
|
|
||||||
|
const skipContinueFlow = async () => {
|
||||||
|
const nextFlow = await this.flowClass.find(refToContinue?.ref, true)
|
||||||
|
const filterNextFlow = nextFlow.filter((msg) => msg.refSerialize !== currentPrev?.refSerialize)
|
||||||
|
const isContinueFlow = filterNextFlow.map((i) => i.keyword).includes(currentPrev?.ref)
|
||||||
|
return {
|
||||||
|
continue: !isContinueFlow,
|
||||||
|
contexts: filterNextFlow,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (endFlowFlag) return
|
if (endFlowFlag) return
|
||||||
for (const msg of parseListMsg) {
|
for (const msg of parseListMsg) {
|
||||||
await this.sendProviderAndSave(from, msg)
|
await this.sendProviderAndSave(from, msg)
|
||||||
}
|
}
|
||||||
const nextFlow = await this.flowClass.find(refToContinue?.ref, true)
|
|
||||||
const filterNextFlow = nextFlow.filter((msg) => msg.refSerialize !== currentPrev?.refSerialize)
|
|
||||||
|
|
||||||
if (filterNextFlow.map((i) => i.keyword).includes(currentPrev?.ref)) return
|
const continueFlowData = await skipContinueFlow()
|
||||||
|
|
||||||
return sendFlow(filterNextFlow, from, { prev: undefined })
|
if (continueFlowData.continue) return sendFlow(continueFlowData.contexts, from, { prev: undefined })
|
||||||
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// 📄 Se encarga de revisar si el contexto del mensaje tiene callback o fallback
|
// 📄 Se encarga de revisar si el contexto del mensaje tiene callback o fallback
|
||||||
|
|||||||
Reference in New Issue
Block a user