mirror of
https://github.com/cheveguerra/botLeiferAurik-Mod_2.0.git
synced 2026-04-18 03:39:16 +00:00
Commit inicial
This commit is contained in:
29
controllers/flows.js
Normal file
29
controllers/flows.js
Normal file
@@ -0,0 +1,29 @@
|
||||
const {get, reply, getIA} = require('../adapter')
|
||||
const {saveExternalFile, checkIsUrl} = require('./handle')
|
||||
|
||||
const getMessages = async (message, num) => { //MOD by CHV - Agregamos el parametro "num" para recibir el numero desde "app.js"
|
||||
// console.log("GETMESSAGES (flow.js)")
|
||||
const data = await get(message, num) //MOD by CHV - Agregamos "num"
|
||||
return data
|
||||
}
|
||||
|
||||
const responseMessages = async (step) => {
|
||||
const data = await reply(step)
|
||||
if(data && data.media){
|
||||
const file = checkIsUrl(data.media) ? await saveExternalFile(data.media) : data.media;
|
||||
return {...data,...{media:file}}
|
||||
}
|
||||
return data
|
||||
}
|
||||
|
||||
const bothResponse = async (message) => {
|
||||
const data = await getIA(message)
|
||||
if(data && data.media){
|
||||
const file = await saveExternalFile(data.media)
|
||||
return {...data,...{media:file}}
|
||||
}
|
||||
return data
|
||||
}
|
||||
|
||||
|
||||
module.exports = { getMessages, responseMessages, bothResponse }
|
||||
Reference in New Issue
Block a user