fix(bot): 🔥 fix rev

This commit is contained in:
Leifer Mendez
2022-12-27 13:42:22 +01:00
parent f2137d310d
commit 484c8c3bde
8 changed files with 143 additions and 47 deletions

View File

@@ -8,10 +8,7 @@ class FlowClass {
if (!Array.isArray(_flow)) throw new Error('Esto debe ser un ARRAY')
this.flowRaw = _flow
this.allCallbacks = _flow
.map((cbIn) => cbIn.ctx.callbacks)
.flat(2)
.map((c, i) => ({ callback: c?.callback, index: i }))
this.getAllCb(this.flowRaw)
const mergeToJsonSerialize = Object.keys(_flow)
.map((indexObjectFlow) => _flow[indexObjectFlow].toJson())
@@ -20,6 +17,17 @@ class FlowClass {
this.flowSerialize = toSerialize(mergeToJsonSerialize)
}
/**
* Buscar y aplanar todos los callbacks
* @param {*} inFlow
*/
getAllCb = (inFlow) => {
this.allCallbacks = inFlow
.map((cbIn) => cbIn.ctx.callbacks)
.flat(2)
.map((c, i) => ({ callback: c?.callback, index: i }))
}
find = (keyOrWord, symbol = false, overFlow = null) => {
keyOrWord = `${keyOrWord}`
let capture = false