mirror of
https://github.com/cheveguerra/bot-whatsapp.git
synced 2026-04-19 12:09:15 +00:00
refactor(io): added new method addChild
This commit is contained in:
@@ -10,6 +10,7 @@ const { toSerialize } = require('./toSerialize')
|
||||
const addAnswer =
|
||||
(inCtx) =>
|
||||
(answer, options, cb = null, nested = []) => {
|
||||
answer = Array.isArray(answer) ? answer.join('\n') : answer
|
||||
/**
|
||||
* Todas las opciones referentes a el mensaje en concreto options:{}
|
||||
* @returns
|
||||
|
||||
15
packages/bot/io/methods/addChild.js
Normal file
15
packages/bot/io/methods/addChild.js
Normal file
@@ -0,0 +1,15 @@
|
||||
const { toSerialize } = require('./toSerialize')
|
||||
/**
|
||||
* @deprecate
|
||||
* @param answer string
|
||||
* @param options {media:string, buttons:[], capture:true default false}
|
||||
* @returns
|
||||
*/
|
||||
const addChild = (flowIn = null) => {
|
||||
if (!flowIn?.toJson) {
|
||||
throw new Error('DEBE SER UN FLOW CON toJSON()')
|
||||
}
|
||||
return toSerialize(flowIn.toJson())
|
||||
}
|
||||
|
||||
module.exports = { addChild }
|
||||
@@ -1,7 +1,8 @@
|
||||
const { addAnswer } = require('./addAnswer')
|
||||
const { addKeyword } = require('./addKeyword')
|
||||
const { addChild } = require('./addChild')
|
||||
const { toSerialize } = require('./toSerialize')
|
||||
const { toCtx } = require('./toCtx')
|
||||
const { toJson } = require('./toJson')
|
||||
|
||||
module.exports = { addAnswer, addKeyword, toCtx, toJson, toSerialize }
|
||||
module.exports = { addAnswer, addKeyword, addChild, toCtx, toJson, toSerialize }
|
||||
|
||||
Reference in New Issue
Block a user