DialogFlow botones por payload

Evita crash si el mensaje excede los 256 caracteres + botones por el payload de DialogFlow
This commit is contained in:
HKong31
2022-12-07 08:02:00 -04:00
committed by HKong31
parent b3c13d5f98
commit f88607c2c2

8
app.js
View File

@@ -57,8 +57,12 @@ const listenMessage = () => client.on('message', async msg => {
if (process.env.DATABASE === 'dialogflow') {
if (!message.length) return;
const response = await bothResponse(message, number);
const response = await bothResponse(message.substring(256,-1), number);
await sendMessage(client, from, response.replyMessage);
if(response.actions){
await sendMessageButton(client, from, null, response.actions);
return
}
if (response.media) {
sendMedia(client, from, response.media);
}
@@ -168,4 +172,4 @@ if (process.env.DATABASE === 'mysql') {
server.listen(port, () => {
console.log(`El server esta listo por el puerto ${port}`);
})
checkEnvFile();
checkEnvFile();