io improvement

This commit is contained in:
Leifer Mendez
2022-10-29 13:07:58 +02:00
parent 860c2bc8fb
commit e00aacfe3e
13 changed files with 168 additions and 67 deletions

View File

@@ -0,0 +1,28 @@
const { generateRef } = require('../utils')
const addAnswer = (inCtx) => (message, options) => {
const lastCtx = inCtx.hasOwnProperty('ctx') ? inCtx.ctx : inCtx
const ctxAnswer = () => {
const ref = generateRef()
/**
* Se guarda en db
*/
return { ...lastCtx, ref, message }
}
const ctx = ctxAnswer()
return {
ctx,
ref: ctx.ref,
addAnswer: addAnswer(ctx),
}
}
module.exports = { addAnswer }
// await inout
// .addKeyword('hola')
// .addAnswer('Bienvenido a tu tienda 🥲')
// .addAnswer('escribe *catalogo* o *ofertas*')