mirror of
https://github.com/cheveguerra/bot-whatsapp.git
synced 2026-04-21 21:19:17 +00:00
Merge branch 'dev' into contributors-readme-action-a4sz8TL1y4
This commit is contained in:
@@ -84,7 +84,7 @@ class CoreClass {
|
|||||||
this.databaseClass.save(ctxByNumber)
|
this.databaseClass.save(ctxByNumber)
|
||||||
}
|
}
|
||||||
|
|
||||||
// 📄 [options: fallback]: esta funcion se encarga de repetir el ultimo mensaje
|
// 📄 [options: fallBack]: esta funcion se encarga de repetir el ultimo mensaje
|
||||||
const fallBack = () => {
|
const fallBack = () => {
|
||||||
fallBackFlag = true
|
fallBackFlag = true
|
||||||
msgToSend = this.flowClass.find(refToContinue?.keyword, true) || []
|
msgToSend = this.flowClass.find(refToContinue?.keyword, true) || []
|
||||||
@@ -92,6 +92,27 @@ class CoreClass {
|
|||||||
return refToContinue
|
return refToContinue
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 📄 [options: flowDynamic]: esta funcion se encarga de responder un array de respuesta esta limitado a 5 mensajes
|
||||||
|
// para evitar bloque de whatsapp
|
||||||
|
const flowDynamic = (listMsg = [], optListMsg = { limit: 3 }) => {
|
||||||
|
if (!Array.isArray(listMsg))
|
||||||
|
throw new Error('Esto debe ser un ARRAY')
|
||||||
|
|
||||||
|
const parseListMsg = listMsg
|
||||||
|
.map(({ body }, index) =>
|
||||||
|
toCtx({
|
||||||
|
body,
|
||||||
|
from,
|
||||||
|
keyword: null,
|
||||||
|
index,
|
||||||
|
})
|
||||||
|
)
|
||||||
|
.slice(0, optListMsg.limit)
|
||||||
|
msgToSend = parseListMsg
|
||||||
|
this.sendFlow(msgToSend, from)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
// 📄 Se encarga de revisar si el contexto del mensaje tiene callback y ejecutarlo
|
// 📄 Se encarga de revisar si el contexto del mensaje tiene callback y ejecutarlo
|
||||||
const cbEveryCtx = (inRef) => {
|
const cbEveryCtx = (inRef) => {
|
||||||
const indexFlow = this.flowClass.findIndexByRef(inRef)
|
const indexFlow = this.flowClass.findIndexByRef(inRef)
|
||||||
@@ -99,6 +120,7 @@ class CoreClass {
|
|||||||
messageCtxInComming,
|
messageCtxInComming,
|
||||||
{
|
{
|
||||||
fallBack,
|
fallBack,
|
||||||
|
flowDynamic,
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -56,6 +56,7 @@ export default component$(() => {
|
|||||||
{
|
{
|
||||||
title: 'Comunidad',
|
title: 'Comunidad',
|
||||||
list: [
|
list: [
|
||||||
|
{ name: 'MasterClass', link: '/docs/masterclass' },
|
||||||
{ name: 'Unirme al proyecto', link: '/docs/join' },
|
{ name: 'Unirme al proyecto', link: '/docs/join' },
|
||||||
{ name: 'Sponsors', link: '/docs/sponsors' },
|
{ name: 'Sponsors', link: '/docs/sponsors' },
|
||||||
],
|
],
|
||||||
|
|||||||
3
packages/docs/src/routes/docs/masterclass/index.mdx
Normal file
3
packages/docs/src/routes/docs/masterclass/index.mdx
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
# MasterClass
|
||||||
|
|
||||||
|
...
|
||||||
Reference in New Issue
Block a user