mirror of
https://github.com/cheveguerra/bot-whatsapp.git
synced 2026-04-18 11:39:15 +00:00
28 lines
717 B
JavaScript
28 lines
717 B
JavaScript
const {get, reply, getIA} = require('../adapter')
|
|
const {saveExternalFile} = require('./handle')
|
|
|
|
const getMessages = async (message) => {
|
|
const data = await get(message)
|
|
return data
|
|
}
|
|
|
|
const responseMessages = async (step) => {
|
|
const data = await reply(step)
|
|
if(data && data.media){
|
|
const file = await saveExternalFile(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 } |