mirror of
https://github.com/cheveguerra/bot-whatsapp.git
synced 2026-04-18 03:29:15 +00:00
33 lines
626 B
JavaScript
33 lines
626 B
JavaScript
const { generateRef } = require('../utils')
|
|
const { addAnswer } = require('./addAnswer')
|
|
/**
|
|
* addKeyword:
|
|
* Es necesario que genere id|hash
|
|
*/
|
|
|
|
/**
|
|
*
|
|
* @param {*} message `string | string[]`
|
|
* @param {*} options {sensitivy:boolean} defaulta false
|
|
*/
|
|
const addKeyword = (message, options) => {
|
|
const ctxAddKeyword = () => {
|
|
const ref = generateRef()
|
|
/**
|
|
* Se guarda en db
|
|
*/
|
|
|
|
return { ref, keyword: message }
|
|
}
|
|
|
|
const ctx = ctxAddKeyword()
|
|
|
|
return {
|
|
ctx,
|
|
ref: ctx.ref,
|
|
addAnswer: addAnswer(ctx),
|
|
}
|
|
}
|
|
|
|
module.exports = { addKeyword }
|