@bot-whatsapp/bot
Advanced tools
Comparing version 0.0.167-alpha.0 to 0.0.168-alpha.0
@@ -161,2 +161,3 @@ const { toCtx } = require('../io/methods') | ||
this.queuePrincipal.clearQueue(from) | ||
return | ||
} | ||
@@ -204,3 +205,3 @@ | ||
if (listProcessWait.includes(lastMessage.ref)) { | ||
this.queuePrincipal.clearQueue(from); | ||
this.queuePrincipal.clearQueue(from) | ||
} | ||
@@ -230,3 +231,3 @@ } | ||
const continueFlow = async (_) => { | ||
const continueFlow = async () => { | ||
const currentPrev = await this.databaseClass.getPrevByNumber(from) | ||
@@ -242,6 +243,6 @@ const nextFlow = (await this.flowClass.find(refToContinue?.ref, true)) ?? [] | ||
(await this.flowClass.find(refToContinueChild?.ref, true, flowStandaloneChild)) || [] | ||
if (nextChildMessages?.length) return await sendFlow(nextChildMessages, from, { prev: undefined }) | ||
if (nextChildMessages?.length) | ||
return exportFunctionsSend(() => sendFlow(nextChildMessages, from, { prev: undefined })) | ||
await sendFlow(filterNextFlow, from, { prev: undefined }) | ||
return | ||
return exportFunctionsSend(() => sendFlow(filterNextFlow, from, { prev: undefined })) | ||
} | ||
@@ -345,2 +346,18 @@ } | ||
const exportFunctionsSend = async (cb = () => Promise.resolve()) => { | ||
await cb() | ||
return { | ||
createCtxMessage, | ||
clearQueue, | ||
endFlow, | ||
sendFlow, | ||
continueFlow, | ||
fallBack, | ||
gotoFlow, | ||
flowDynamic, | ||
resolveCbEveryCtx, | ||
cbEveryCtx, | ||
} | ||
} | ||
// ๐๐ค(tiene return) [options: nested(array)]: Si se tiene flujos hijos los implementa | ||
@@ -355,4 +372,3 @@ if (!endFlowFlag && prevMsg?.options?.nested?.length) { | ||
await sendFlow(msgToSend, from) | ||
return | ||
return exportFunctionsSend(() => sendFlow(msgToSend, from)) | ||
} | ||
@@ -366,4 +382,3 @@ | ||
msgToSend = this.flowClass.find(refToContinue?.ref, true) || [] | ||
await sendFlow(msgToSend, from) | ||
return | ||
return exportFunctionsSend(() => sendFlow(msgToSend, from, { forceQueue: true })) | ||
} | ||
@@ -374,3 +389,5 @@ } | ||
if (msgToSend.length) return sendFlow(msgToSend, from) | ||
if (msgToSend.length) { | ||
return exportFunctionsSend(() => sendFlow(msgToSend, from)) | ||
} | ||
@@ -396,3 +413,3 @@ if (!prevMsg?.options?.capture) { | ||
} | ||
return sendFlow(msgToSend, from, {forceQueue:true}) | ||
return exportFunctionsSend(() => sendFlow(msgToSend, from, { forceQueue: true })) | ||
} | ||
@@ -409,8 +426,7 @@ | ||
const { answer } = ctxMessage | ||
logger.log(`[sendProviderAndSave]: `, ctxMessage) | ||
if (answer && answer.length && answer !== '__call_action__') { | ||
await this.providerClass.sendMessage(numberOrId, answer, ctxMessage) | ||
logger.log(`[providerClass.sendMessage]: `, ctxMessage) | ||
if (answer !== '__capture_only_intended__') { | ||
await this.providerClass.sendMessage(numberOrId, answer, ctxMessage) | ||
} | ||
await this.databaseClass.save({ ...ctxMessage, from: numberOrId }) | ||
logger.log(`[databaseClass.save]: `, ctxMessage) | ||
} | ||
@@ -421,3 +437,2 @@ | ||
logger.log(`[ERROR.save]: `, ctxMessage) | ||
console.log('ERROR:Enviando') | ||
return Promise.reject | ||
@@ -424,0 +439,0 @@ } |
@@ -0,0 +0,0 @@ const { generateRef } = require('../../utils/hash') |
@@ -0,0 +0,0 @@ const { generateRef } = require('../../utils/hash') |
@@ -0,0 +0,0 @@ const { generateRef } = require('../../utils/hash') |
@@ -0,0 +0,0 @@ const { generateRef } = require('../../utils/hash') |
@@ -0,0 +0,0 @@ const { generateRef } = require('../../utils/hash') |
@@ -0,0 +0,0 @@ const { generateRef } = require('../../utils/hash') |
@@ -0,0 +0,0 @@ const { eventDocument, REGEX_EVENT_DOCUMENT } = require('./eventDocument') |
@@ -0,0 +0,0 @@ const { toSerialize } = require('./methods/toSerialize') |
const addAction = () => async () => {} | ||
module.exports = { addAction } |
@@ -100,3 +100,6 @@ const { flatObject } = require('../../utils/flattener') | ||
addAnswer: addAnswer(ctx), | ||
addAction: (cb = () => null) => addAnswer(ctx)('__call_action__', null, cb), | ||
addAction: (cb = () => null, flagCb = () => null) => { | ||
if (typeof cb === 'object') return addAnswer(ctx)('__capture_only_intended__', cb, flagCb) | ||
return addAnswer(ctx)('__call_action__', null, cb) | ||
}, | ||
toJson: toJson(ctx), | ||
@@ -103,0 +106,0 @@ } |
@@ -0,0 +0,0 @@ const { generateRef } = require('../../utils/hash') |
@@ -0,0 +0,0 @@ MIT License |
{ | ||
"name": "@bot-whatsapp/bot", | ||
"version": "0.0.167-alpha.0", | ||
"version": "0.0.168-alpha.0", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "./lib/bundle.bot.cjs", |
@@ -0,0 +0,0 @@ const { EventEmitter } = require('node:events') |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
118370
3140