add class

This commit is contained in:
Leifer Mendez
2022-11-08 15:46:38 +01:00
parent 2442b59a5f
commit d9492eeee6
4 changed files with 218 additions and 13 deletions

View File

@@ -3,13 +3,15 @@ const { toJson } = require('./toJson')
/**
*
* @param answer string
* @param options {media:string, buttons:[]}
* @param options {media:string, buttons:[], capture:true default false}
* @returns
*/
const addAnswer = (inCtx) => (answer, options) => {
const getAnswerOptions = () => ({
media: typeof options?.media === 'string' ? `${options?.media}` : null,
buttons: Array.isArray(options?.buttons) ? options.buttons : [],
capture:
typeof options?.capture === 'boolean' ? options?.capture : false,
})
const lastCtx = inCtx.hasOwnProperty('ctx') ? inCtx.ctx : inCtx