mirror of
https://github.com/cheveguerra/bot-whatsapp.git
synced 2026-04-19 20:19:15 +00:00
working child flow
This commit is contained in:
1
TODO.md
1
TODO.md
@@ -3,3 +3,4 @@
|
|||||||
- [ ] .addKeyword('1') no funciona con 1 caracter
|
- [ ] .addKeyword('1') no funciona con 1 caracter
|
||||||
- [ ] sensitivy viene activado por defecto
|
- [ ] sensitivy viene activado por defecto
|
||||||
- [ ] colocar mensaje esperando conectando whatsapp (provider)
|
- [ ] colocar mensaje esperando conectando whatsapp (provider)
|
||||||
|
- [ ] fallback respuesta en hijo
|
||||||
@@ -77,7 +77,7 @@ class CoreClass {
|
|||||||
if (prevMsg?.options?.nested?.length) {
|
if (prevMsg?.options?.nested?.length) {
|
||||||
const nestedRef = prevMsg.options.nested
|
const nestedRef = prevMsg.options.nested
|
||||||
const flowStandalone = nestedRef.map((f) => ({
|
const flowStandalone = nestedRef.map((f) => ({
|
||||||
...this.flowClass.findBySerialize(f),
|
...nestedRef.find((r) => r.refSerialize === f.refSerialize),
|
||||||
}))
|
}))
|
||||||
|
|
||||||
msgToSend = this.flowClass.find(body, false, flowStandalone) || []
|
msgToSend = this.flowClass.find(body, false, flowStandalone) || []
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ const toSerialize = (flowJson) => {
|
|||||||
...row,
|
...row,
|
||||||
refSerialize: `${generateRefSerialize({
|
refSerialize: `${generateRefSerialize({
|
||||||
index,
|
index,
|
||||||
|
keyword: row.keyword,
|
||||||
answer: row.answer,
|
answer: row.answer,
|
||||||
})}`,
|
})}`,
|
||||||
}))
|
}))
|
||||||
|
|||||||
@@ -15,10 +15,10 @@ const generateRef = (prefix = false) => {
|
|||||||
* @param {*} param0
|
* @param {*} param0
|
||||||
* @returns
|
* @returns
|
||||||
*/
|
*/
|
||||||
const generateRefSerialize = ({ index, answer }) =>
|
const generateRefSerialize = ({ index, answer, keyword }) =>
|
||||||
crypto
|
crypto
|
||||||
.createHash('md5')
|
.createHash('md5')
|
||||||
.update(JSON.stringify({ index, answer }))
|
.update(JSON.stringify({ index, answer, keyword }))
|
||||||
.digest('hex')
|
.digest('hex')
|
||||||
|
|
||||||
module.exports = { generateRef, generateRefSerialize }
|
module.exports = { generateRef, generateRefSerialize }
|
||||||
|
|||||||
Reference in New Issue
Block a user