From 9b6ce926126f9a4483932f6e1be0ef32ed81e474 Mon Sep 17 00:00:00 2001 From: Leifer Mendez Date: Mon, 31 Oct 2022 09:51:18 +0100 Subject: [PATCH 01/47] Update diaglogflow.js --- adapter/diaglogflow.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/adapter/diaglogflow.js b/adapter/diaglogflow.js index c80b034..88a24c1 100644 --- a/adapter/diaglogflow.js +++ b/adapter/diaglogflow.js @@ -56,7 +56,7 @@ const detectIntent = async (queryText) => { const { fields } = parsePayload.payload media = fields.media.stringValue || null } - const customPayload = parsePayload['payload'] + const customPayload = parsePayload ? parsePayload['payload'] : null const parseData = { replyMessage: queryResult.fulfillmentText, From 8a4f134327ccb608f2b03a5cd937beab79a96f27 Mon Sep 17 00:00:00 2001 From: Leifer Mendez Date: Sat, 19 Nov 2022 11:08:51 +0100 Subject: [PATCH 02/47] Update latest --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index df28d5d..42d881d 100644 --- a/package.json +++ b/package.json @@ -43,7 +43,7 @@ "qrcode-terminal": "^0.12.0", "socket.io": "^4.5.1", "stormdb": "^0.6.0", - "whatsapp-web.js": "^1.18.0", + "whatsapp-web.js": "latest", "xlsx": "^0.18.5" }, "devDependencies": { From f21a58b6ffefc631cb7fbc413e66ed2b1eb753bb Mon Sep 17 00:00:00 2001 From: jzvi12 Date: Fri, 2 Dec 2022 10:16:16 -0500 Subject: [PATCH 03/47] Update README.md --- README.md | 47 ++++------------------------------------------- 1 file changed, 4 insertions(+), 43 deletions(-) diff --git a/README.md b/README.md index 455d71e..8be6f57 100644 --- a/README.md +++ b/README.md @@ -1,27 +1,4 @@ ## Chatbot Whatsapp (OpenSource) -#### Actualizado Abril 2022 - -El siguiente proyecto se realizó con fines educativos para el canal de [Youtube (Leifer Mendez)](https://www.youtube.com/channel/UCgrIGp5QAnC0J8LfNJxDRDw?sub_confirmation=1) donde aprendemos a crear y implementar un chatbot increíble usando [node.js](https://codigoencasa.com/tag/nodejs/) además le agregamos inteligencia artificial gracias al servicio de __dialogflow__. - -[![Video](https://i.giphy.com/media/OBDi3CXC83WkNeLEZP/giphy.webp)](https://youtu.be/5lEMCeWEJ8o) - -### ATENCION 🔴 -> 💥💥 Si te aparece el Error Multi-device es porque tienes la cuenta de whatsapp afiliada al modo "BETA de Multi dispositivo" por el momento no se tiene soporte para esas personas si tu quieres hacer uso de este __BOT__ debes de salir del modo BETA y intentarlo de la manera tradicional - -> El core de whatsapp esta en constante actualizaciones por lo cual siempre revisa la ultima fecha de la actualizacion -> [VER](https://github.com/leifermendez/bot-whatsapp/commits/main) - -### Busco colaboradores ⭐ -Hola amigos me gusta mucho este proyecto pero por cuestiones de tiempo se me dificulta mantener las actualizaciones si alguno quieres participar en el proyecto escribeme a leifer.contacto@gmail.com - -#### Acceso rápido -> Si tienes una cuenta en __heroku__ puedes desplegar este proyecto con (1 click) - -[![Deploy](https://www.herokucdn.com/deploy/button.svg)](https://heroku.com/deploy?template=https://github.com/leifermendez/bot-whatsapp) - -> Comprarme un cafe! - -[![Comprar](https://www.buymeacoffee.com/assets/img/custom_images/orange_img.png)](https://www.buymeacoffee.com/leifermendez) #### Actualización @@ -81,7 +58,6 @@ await sendMediaVoiceNote(client, from, 'PTT-20220223-WA0000.opus') ## Instruciones __Descargar o Clonar repositorio__ -![](https://i.imgur.com/dSpUbFz.png) __Usas ¿Ubuntu / Linux?__ > Asegurate de instalar los siguientes paquetes @@ -93,9 +69,9 @@ sudo apt install -y gconf-service libasound2 libatk1.0-0 libc6 libcairo2 libcups __Instalar dependencias (npm install)__ > Ubicate en le directorio que descargaste y via consola o terminal ejecuta el siguiente comando -`npm install` - -![](https://i.imgur.com/BJuMjGR.png) +``` +npm i +``` __Configurar .env__ > Con el editor de texto crea un archivo `.env` el cual debes de guiarte del archivo `.env.example` @@ -114,21 +90,14 @@ SQL_PASS= SQL_DATABASE= ``` -![](https://i.imgur.com/9poNnW0.png) - __Ejecutar el script__ > Ubicate en le directorio que descargaste y via consola o terminal ejecuta el siguiente comando `npm run start` -![](https://i.imgur.com/eMkBkuJ.png) - __Whatsapp en tu celular__ > Ahora abre la aplicación de Whatsapp en tu dispositivo y escanea el código QR -Visitar la pagina -`http://localhost:3000/qr` - -![](https://i.imgur.com/Q3JEDlP.png) +Tambien puedes visitar la pagina http://127.0.0.1:3000/qr __Listo 😎__ > Cuando sale este mensaje tu BOT está __listo__ para trabajar! @@ -145,11 +114,3 @@ __Listo 😎__ > Ahora deberías obtener un arespuesta por parte del BOT como la siguiente, ademas de esto tambien se crea un archivo excel con el historial de conversación con el número de tu cliente - -![](https://i.imgur.com/lrMLgR8.png) -![](https://i.imgur.com/UYcoUSV.png) - -## Preguntar al BOT -> Puedes interactuar con el bot ejemplo escribele __hola__ y el bot debe responderte! - -![](https://i.imgur.com/cNAS51I.png) From 1884832192e00ea4b6a70bd6660cb57a24ad3e50 Mon Sep 17 00:00:00 2001 From: jzvi12 Date: Mon, 5 Dec 2022 19:10:41 -0500 Subject: [PATCH 04/47] fixed dialogflow session id --- adapter/diaglogflow.js | 12 +++++------ adapter/index.js | 4 ++-- app.js | 47 +++++++++++++++++++++--------------------- controllers/flows.js | 4 ++-- package-lock.json | 42 +++++++------------------------------ package.json | 2 +- 6 files changed, 42 insertions(+), 69 deletions(-) diff --git a/adapter/diaglogflow.js b/adapter/diaglogflow.js index 88a24c1..1d0d9a8 100644 --- a/adapter/diaglogflow.js +++ b/adapter/diaglogflow.js @@ -1,6 +1,6 @@ const dialogflow = require('@google-cloud/dialogflow'); const fs = require('fs') -const crypto = require('crypto'); + /** * Debes de tener tu archivo con el nombre "chatbot-account.json" en la raíz del proyecto */ @@ -30,9 +30,9 @@ const checkFileCredentials = () => { // Detect intent method -const detectIntent = async (queryText) => { +const detectIntent = async (queryText, waPhoneNumber) => { let media = null; - const sessionId = KEEP_DIALOG_FLOW ? 1 : crypto.randomUUID(); + const sessionId = KEEP_DIALOG_FLOW ? 1 : waPhoneNumber; const sessionPath = sessionClient.projectAgentSessionPath(PROJECID, sessionId); const languageCode = process.env.LANGUAGE const request = { @@ -66,12 +66,12 @@ const detectIntent = async (queryText) => { return parseData } -const getDataIa = (message = '', cb = () => { }) => { - detectIntent(message).then((res) => { +const getDataIa = (message = '', sessionId = '', cb = () => { }) => { + detectIntent(message, sessionId).then((res) => { cb(res) }) } checkFileCredentials(); -module.exports = { getDataIa } +module.exports = { getDataIa } \ No newline at end of file diff --git a/adapter/index.js b/adapter/index.js index 6f06561..e6e5d74 100644 --- a/adapter/index.js +++ b/adapter/index.js @@ -52,13 +52,13 @@ const reply = (step) => new Promise((resolve, reject) => { } }) -const getIA = (message) => new Promise((resolve, reject) => { +const getIA = (message, sessionId) => new Promise((resolve, reject) => { /** * Si usas dialogflow */ if (process.env.DATABASE === 'dialogflow') { let resData = { replyMessage: '', media: null, trigger: null } - getDataIa(message,(dt) => { + getDataIa(message, sessionId, (dt) => { resData = { ...resData, ...dt } resolve(resData) }) diff --git a/app.js b/app.js index 755b924..36580c1 100644 --- a/app.js +++ b/app.js @@ -6,7 +6,7 @@ const fs = require('fs'); const express = require('express'); const cors = require('cors') const qrcode = require('qrcode-terminal'); -const { Client,LocalAuth } = require('whatsapp-web.js'); +const { Client, LocalAuth } = require('whatsapp-web.js'); const mysqlConnection = require('./config/mysql') const { middlewareClient } = require('./middleware/client') const { generateImage, cleanNumber, checkEnvFile, createClient, isValidNumber } = require('./controllers/handle') @@ -30,7 +30,7 @@ app.use('/', require('./routes/web')) const listenMessage = () => client.on('message', async msg => { const { from, body, hasMedia } = msg; - if(!isValidNumber(from)){ + if (!isValidNumber(from)) { return } @@ -39,7 +39,7 @@ const listenMessage = () => client.on('message', async msg => { return } message = body.toLowerCase(); - console.log('BODY',message) + console.log('BODY', message) const number = cleanNumber(from) await readChat(number, message) @@ -56,8 +56,8 @@ const listenMessage = () => client.on('message', async msg => { */ if (process.env.DATABASE === 'dialogflow') { - if(!message.length) return; - const response = await bothResponse(message); + if (!message.length) return; + const response = await bothResponse(message, number); await sendMessage(client, from, response.replyMessage); if (response.media) { sendMedia(client, from, response.media); @@ -91,7 +91,7 @@ const listenMessage = () => client.on('message', async msg => { await sendMessage(client, from, response.replyMessage, response.trigger); - if(response.hasOwnProperty('actions')){ + if (response.hasOwnProperty('actions')) { const { actions } = response; await sendMessageButton(client, from, null, actions); return @@ -116,7 +116,7 @@ const listenMessage = () => client.on('message', async msg => { /** * Si quieres enviar botones */ - if(response.hasOwnProperty('actions')){ + if (response.hasOwnProperty('actions')) { const { actions } = response; await sendMessageButton(client, from, null, actions); } @@ -127,33 +127,33 @@ const listenMessage = () => client.on('message', async msg => { client = new Client({ - authStrategy: new LocalAuth(), - puppeteer: { headless: true } - }); - + authStrategy: new LocalAuth(), + puppeteer: { headless: true } +}); + client.on('qr', qr => generateImage(qr, () => { - qrcode.generate(qr, { small: true }); - - console.log(`Ver QR http://localhost:${port}/qr`) - socketEvents.sendQR(qr) + qrcode.generate(qr, { small: true }); + + console.log(`Ver QR http://localhost:${port}/qr`) + socketEvents.sendQR(qr) })) client.on('ready', (a) => { - connectionReady() - listenMessage() - // socketEvents.sendStatus(client) + connectionReady() + listenMessage() + // socketEvents.sendStatus(client) }); client.on('auth_failure', (e) => { - // console.log(e) - // connectionLost() + // console.log(e) + // connectionLost() }); client.on('authenticated', () => { - console.log('AUTHENTICATED'); + console.log('AUTHENTICATED'); }); - client.initialize(); +client.initialize(); @@ -168,5 +168,4 @@ if (process.env.DATABASE === 'mysql') { server.listen(port, () => { console.log(`El server esta listo por el puerto ${port}`); }) -checkEnvFile(); - +checkEnvFile(); \ No newline at end of file diff --git a/controllers/flows.js b/controllers/flows.js index 0e769cd..b0fc9d3 100644 --- a/controllers/flows.js +++ b/controllers/flows.js @@ -15,8 +15,8 @@ const responseMessages = async (step) => { return data } -const bothResponse = async (message) => { - const data = await getIA(message) +const bothResponse = async (message, sessionId) => { + const data = await getIA(message, sessionId) if(data && data.media){ const file = await saveExternalFile(data.media) return {...data,...{media:file}} diff --git a/package-lock.json b/package-lock.json index 5e7dbf1..589ad0f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -22,13 +22,12 @@ "qrcode-terminal": "^0.12.0", "socket.io": "^4.5.1", "stormdb": "^0.6.0", - "whatsapp-web.js": "^1.18.0", + "whatsapp-web.js": "^1.18.4", "xlsx": "^0.18.5" }, "devDependencies": { "pm2": "^5.2.0", - "prettier": "2.7.1", - "rollup": "^3.2.3" + "prettier": "2.7.1" }, "engines": { "node": "16.x" @@ -4242,22 +4241,6 @@ "url": "https://github.com/sponsors/isaacs" } }, - "node_modules/rollup": { - "version": "3.2.3", - "resolved": "https://registry.npmjs.org/rollup/-/rollup-3.2.3.tgz", - "integrity": "sha512-qfadtkY5kl0F5e4dXVdj2D+GtOdifasXHFMiL1SMf9ADQDv5Eti6xReef9FKj+iQPR2pvtqWna57s/PjARY4fg==", - "dev": true, - "bin": { - "rollup": "dist/bin/rollup" - }, - "engines": { - "node": ">=14.18.0", - "npm": ">=8.0.0" - }, - "optionalDependencies": { - "fsevents": "~2.3.2" - } - }, "node_modules/run-series": { "version": "1.1.9", "resolved": "https://registry.npmjs.org/run-series/-/run-series-1.1.9.tgz", @@ -5039,9 +5022,9 @@ "integrity": "sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==" }, "node_modules/whatsapp-web.js": { - "version": "1.18.0", - "resolved": "https://registry.npmjs.org/whatsapp-web.js/-/whatsapp-web.js-1.18.0.tgz", - "integrity": "sha512-3cCW28/w7llZmTgiO9osumaopOuBBduvyuW02yfy3q9Rz4Wq9Oe1dRedE/kkq764zB8AZcuTs0tE8OKTq2Zobw==", + "version": "1.18.4", + "resolved": "https://registry.npmjs.org/whatsapp-web.js/-/whatsapp-web.js-1.18.4.tgz", + "integrity": "sha512-Dqu6Q37tDDAcVJ44aMdRE76sI/9rBCUG+NTz1Kxh2w4obX2WtpoRetilxqgx1r4+pFUl58Lf21wGOEwPZ1pT/A==", "dependencies": { "@pedroslopez/moduleraid": "^5.0.2", "fluent-ffmpeg": "^2.1.2", @@ -8598,15 +8581,6 @@ "glob": "^7.1.3" } }, - "rollup": { - "version": "3.2.3", - "resolved": "https://registry.npmjs.org/rollup/-/rollup-3.2.3.tgz", - "integrity": "sha512-qfadtkY5kl0F5e4dXVdj2D+GtOdifasXHFMiL1SMf9ADQDv5Eti6xReef9FKj+iQPR2pvtqWna57s/PjARY4fg==", - "dev": true, - "requires": { - "fsevents": "~2.3.2" - } - }, "run-series": { "version": "1.1.9", "resolved": "https://registry.npmjs.org/run-series/-/run-series-1.1.9.tgz", @@ -9193,9 +9167,9 @@ "integrity": "sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==" }, "whatsapp-web.js": { - "version": "1.18.0", - "resolved": "https://registry.npmjs.org/whatsapp-web.js/-/whatsapp-web.js-1.18.0.tgz", - "integrity": "sha512-3cCW28/w7llZmTgiO9osumaopOuBBduvyuW02yfy3q9Rz4Wq9Oe1dRedE/kkq764zB8AZcuTs0tE8OKTq2Zobw==", + "version": "1.18.4", + "resolved": "https://registry.npmjs.org/whatsapp-web.js/-/whatsapp-web.js-1.18.4.tgz", + "integrity": "sha512-Dqu6Q37tDDAcVJ44aMdRE76sI/9rBCUG+NTz1Kxh2w4obX2WtpoRetilxqgx1r4+pFUl58Lf21wGOEwPZ1pT/A==", "requires": { "@pedroslopez/moduleraid": "^5.0.2", "archiver": "^5.3.1", diff --git a/package.json b/package.json index 42d881d..20a8d94 100644 --- a/package.json +++ b/package.json @@ -43,7 +43,7 @@ "qrcode-terminal": "^0.12.0", "socket.io": "^4.5.1", "stormdb": "^0.6.0", - "whatsapp-web.js": "latest", + "whatsapp-web.js": "^1.18.4", "xlsx": "^0.18.5" }, "devDependencies": { From b3c13d5f983a8ca4168b9a9e7adef5e431c6bf30 Mon Sep 17 00:00:00 2001 From: HKong31 <113340082+HKong31@users.noreply.github.com> Date: Wed, 7 Dec 2022 07:52:13 -0400 Subject: [PATCH 05/47] DialogFlow botones por payload --- adapter/diaglogflow.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/adapter/diaglogflow.js b/adapter/diaglogflow.js index 1d0d9a8..9a4586c 100644 --- a/adapter/diaglogflow.js +++ b/adapter/diaglogflow.js @@ -1,5 +1,6 @@ const dialogflow = require('@google-cloud/dialogflow'); const fs = require('fs') +const {struct} = require('pb-util'); /** * Debes de tener tu archivo con el nombre "chatbot-account.json" en la raíz del proyecto @@ -32,6 +33,7 @@ const checkFileCredentials = () => { // Detect intent method const detectIntent = async (queryText, waPhoneNumber) => { let media = null; + let actions = null; const sessionId = KEEP_DIALOG_FLOW ? 1 : waPhoneNumber; const sessionPath = sessionClient.projectAgentSessionPath(PROJECID, sessionId); const languageCode = process.env.LANGUAGE @@ -54,6 +56,7 @@ const detectIntent = async (queryText, waPhoneNumber) => { // console.log(singleResponse) if (parsePayload && parsePayload.payload) { const { fields } = parsePayload.payload + actions = struct.decode(fields.actions.structValue) || null; media = fields.media.stringValue || null } const customPayload = parsePayload ? parsePayload['payload'] : null @@ -61,6 +64,7 @@ const detectIntent = async (queryText, waPhoneNumber) => { const parseData = { replyMessage: queryResult.fulfillmentText, media, + actions, trigger: null } return parseData @@ -74,4 +78,4 @@ const getDataIa = (message = '', sessionId = '', cb = () => { }) => { checkFileCredentials(); -module.exports = { getDataIa } \ No newline at end of file +module.exports = { getDataIa } From f88607c2c2945553ce46a6a3ec688219d597ffd6 Mon Sep 17 00:00:00 2001 From: HKong31 <113340082+HKong31@users.noreply.github.com> Date: Wed, 7 Dec 2022 08:02:00 -0400 Subject: [PATCH 06/47] DialogFlow botones por payload Evita crash si el mensaje excede los 256 caracteres + botones por el payload de DialogFlow --- app.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/app.js b/app.js index 36580c1..77d773a 100644 --- a/app.js +++ b/app.js @@ -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(); \ No newline at end of file +checkEnvFile(); From 2d6c1879cedcc47a936e21b44c255756fff32849 Mon Sep 17 00:00:00 2001 From: HKong31 <113340082+HKong31@users.noreply.github.com> Date: Wed, 7 Dec 2022 08:18:32 -0400 Subject: [PATCH 07/47] DialogFlow botones por payload --- package-lock.json | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/package-lock.json b/package-lock.json index 589ad0f..af9632e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -18,6 +18,7 @@ "mime-db": "^1.52.0", "moment": "^2.29.4", "mysql": "^2.18.1", + "pb-util": "^1.0.3", "qr-image": "^3.2.0", "qrcode-terminal": "^0.12.0", "socket.io": "^4.5.1", @@ -3415,6 +3416,11 @@ "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.7.tgz", "integrity": "sha512-5DFkuoqlv1uYQKxy8omFBeJPQcdoE07Kv2sferDCrAq1ohOU+MSDswDIbnx3YAM60qIOnYa53wBhXW0EbMonrQ==" }, + "node_modules/pb-util": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/pb-util/-/pb-util-1.0.3.tgz", + "integrity": "sha512-8+weUH2YEYnPf5sTpZ3q7Drq41tSEL8vDSU96/CzSvu2qrbspbjbbuKLjHocAQpmyMbICTcvovVl3cETwxwIkQ==" + }, "node_modules/peek-readable": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/peek-readable/-/peek-readable-5.0.0.tgz", @@ -7965,6 +7971,11 @@ "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.7.tgz", "integrity": "sha512-5DFkuoqlv1uYQKxy8omFBeJPQcdoE07Kv2sferDCrAq1ohOU+MSDswDIbnx3YAM60qIOnYa53wBhXW0EbMonrQ==" }, + "pb-util": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/pb-util/-/pb-util-1.0.3.tgz", + "integrity": "sha512-8+weUH2YEYnPf5sTpZ3q7Drq41tSEL8vDSU96/CzSvu2qrbspbjbbuKLjHocAQpmyMbICTcvovVl3cETwxwIkQ==" + }, "peek-readable": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/peek-readable/-/peek-readable-5.0.0.tgz", From b24c005e3e2d406ee43508ed4a9ae95810ba1b00 Mon Sep 17 00:00:00 2001 From: HKong31 <113340082+HKong31@users.noreply.github.com> Date: Wed, 7 Dec 2022 08:20:30 -0400 Subject: [PATCH 08/47] DialogFlow botones por payload --- package.json | 1 + 1 file changed, 1 insertion(+) diff --git a/package.json b/package.json index 20a8d94..fcb275f 100644 --- a/package.json +++ b/package.json @@ -39,6 +39,7 @@ "mime-db": "^1.52.0", "moment": "^2.29.4", "mysql": "^2.18.1", + "pb-util": "^1.0.3", "qr-image": "^3.2.0", "qrcode-terminal": "^0.12.0", "socket.io": "^4.5.1", From babff11c70df7b05e104ca0e08d13f8938fa5064 Mon Sep 17 00:00:00 2001 From: HKong31 <113340082+HKong31@users.noreply.github.com> Date: Wed, 7 Dec 2022 08:33:14 -0400 Subject: [PATCH 09/47] Fix crash when voice message recieved Fix crash si recibe nota de voz --- controllers/save.js | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/controllers/save.js b/controllers/save.js index 92555e0..3adfda0 100644 --- a/controllers/save.js +++ b/controllers/save.js @@ -8,11 +8,17 @@ const fs = require('fs') const saveMedia = (media) => { - const extensionProcess = mimeDb[media.mimetype] - const ext = extensionProcess.extensions[0] + const extensionProcess = mimeDb[media.mimetype]; + let ext; + if (!extensionProcess) { + const fileType = media.mimetype.split('/'); + ext = fileType[1].split(';')[0]; + } else { + ext = extensionProcess.extensions[0]; + } fs.writeFile(`./media/${Date.now()}.${ext}`, media.data, { encoding: 'base64' }, function (err) { console.log('** Archivo Media Guardado **'); }); } -module.exports = {saveMedia} \ No newline at end of file +module.exports = {saveMedia} From e8aed880d8c9b89e67df52c99a88309be5f68a13 Mon Sep 17 00:00:00 2001 From: HKong31 <113340082+HKong31@users.noreply.github.com> Date: Wed, 7 Dec 2022 12:19:06 -0400 Subject: [PATCH 10/47] =?UTF-8?q?Retraso=20en=20el=20env=C3=ADo=20de=20bot?= =?UTF-8?q?ones?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Modificado para que los botones sean enviados después del mensaje --- controllers/send.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/controllers/send.js b/controllers/send.js index d081381..5cda9ac 100644 --- a/controllers/send.js +++ b/controllers/send.js @@ -69,12 +69,14 @@ const sendMessage = async (client, number = null, text = null, trigger = null) = * @param {*} number */ const sendMessageButton = async (client, number = null, text = null, actionButtons) => { + setTimeout(async () => { number = cleanNumber(number) const { title = null, message = null, footer = null, buttons = [] } = actionButtons; let button = new Buttons(message,[...buttons], title, footer); client.sendMessage(number, button); - + await readChat(number, message, actionButtons) console.log(`⚡⚡⚡ Enviando mensajes....`); + }, DELAY_TIME) } From 33490dc737e80b52ea163bd19c61555e9a9ea438 Mon Sep 17 00:00:00 2001 From: jzvi12 Date: Thu, 8 Dec 2022 16:57:18 -0500 Subject: [PATCH 11/47] fixed typo in controllers/send.js --- controllers/send.js | 4 ++-- package-lock.json | 13 ++++++------- package.json | 2 +- 3 files changed, 9 insertions(+), 10 deletions(-) diff --git a/controllers/send.js b/controllers/send.js index 5cda9ac..8ec66a4 100644 --- a/controllers/send.js +++ b/controllers/send.js @@ -16,7 +16,7 @@ const { saveMessage } = require('../adapter') */ const sendMedia = (client, number = null, fileName = null) => { - if(!client) return cosnole.error("El objeto cliente no está definido."); + if(!client) return console.error("El objeto cliente no está definido."); try { number = cleanNumber(number || 0) const file = `${DIR_MEDIA}/${fileName}`; @@ -36,7 +36,7 @@ const sendMedia = (client, number = null, fileName = null) => { */ const sendMediaVoiceNote = (client, number = null, fileName = null) => { - if(!client) return cosnole.error("El objeto cliente no está definido."); + if(!client) return console.error("El objeto cliente no está definido."); try { number = cleanNumber(number || 0) const file = `${DIR_MEDIA}/${fileName}`; diff --git a/package-lock.json b/package-lock.json index af9632e..cf333c3 100644 --- a/package-lock.json +++ b/package-lock.json @@ -23,7 +23,7 @@ "qrcode-terminal": "^0.12.0", "socket.io": "^4.5.1", "stormdb": "^0.6.0", - "whatsapp-web.js": "^1.18.4", + "whatsapp-web.js": "github:pedroslopez/whatsapp-web.js#fix-buttons-list", "xlsx": "^0.18.5" }, "devDependencies": { @@ -5028,9 +5028,9 @@ "integrity": "sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==" }, "node_modules/whatsapp-web.js": { - "version": "1.18.4", - "resolved": "https://registry.npmjs.org/whatsapp-web.js/-/whatsapp-web.js-1.18.4.tgz", - "integrity": "sha512-Dqu6Q37tDDAcVJ44aMdRE76sI/9rBCUG+NTz1Kxh2w4obX2WtpoRetilxqgx1r4+pFUl58Lf21wGOEwPZ1pT/A==", + "version": "1.18.3-alpha.0", + "resolved": "git+ssh://git@github.com/pedroslopez/whatsapp-web.js.git#c8fe80635afc6fba9913577a3097e8bf1f557a0b", + "license": "Apache-2.0", "dependencies": { "@pedroslopez/moduleraid": "^5.0.2", "fluent-ffmpeg": "^2.1.2", @@ -9178,9 +9178,8 @@ "integrity": "sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==" }, "whatsapp-web.js": { - "version": "1.18.4", - "resolved": "https://registry.npmjs.org/whatsapp-web.js/-/whatsapp-web.js-1.18.4.tgz", - "integrity": "sha512-Dqu6Q37tDDAcVJ44aMdRE76sI/9rBCUG+NTz1Kxh2w4obX2WtpoRetilxqgx1r4+pFUl58Lf21wGOEwPZ1pT/A==", + "version": "git+ssh://git@github.com/pedroslopez/whatsapp-web.js.git#c8fe80635afc6fba9913577a3097e8bf1f557a0b", + "from": "whatsapp-web.js@github:pedroslopez/whatsapp-web.js#fix-buttons-list", "requires": { "@pedroslopez/moduleraid": "^5.0.2", "archiver": "^5.3.1", diff --git a/package.json b/package.json index fcb275f..147e1c8 100644 --- a/package.json +++ b/package.json @@ -44,7 +44,7 @@ "qrcode-terminal": "^0.12.0", "socket.io": "^4.5.1", "stormdb": "^0.6.0", - "whatsapp-web.js": "^1.18.4", + "whatsapp-web.js": "github:pedroslopez/whatsapp-web.js#fix-buttons-list", "xlsx": "^0.18.5" }, "devDependencies": { From 2858e910dcbc0a92a2d886b8e85256d919ee1872 Mon Sep 17 00:00:00 2001 From: Leifer Mendez Date: Sun, 11 Dec 2022 22:20:49 +0100 Subject: [PATCH 12/47] Create LICENSE.md --- LICENSE.md | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 LICENSE.md diff --git a/LICENSE.md b/LICENSE.md new file mode 100644 index 0000000..959d8ec --- /dev/null +++ b/LICENSE.md @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2022 Leifer Mendez + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. From 5303dd7d257da8b8062df732edfac0960b83caa6 Mon Sep 17 00:00:00 2001 From: Leifer Mendez Date: Mon, 12 Dec 2022 00:44:58 +0100 Subject: [PATCH 13/47] Create FUNDING.yml --- .github/FUNDING.yml | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 .github/FUNDING.yml diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml new file mode 100644 index 0000000..1fde58c --- /dev/null +++ b/.github/FUNDING.yml @@ -0,0 +1,2 @@ +patreon: leifermendez +custom: "https://www.buymeacoffee.com/leifermendez" From ec32dc429f005940becd3e4c279691188ed7a157 Mon Sep 17 00:00:00 2001 From: Leifer Mendez Date: Mon, 12 Dec 2022 16:42:12 +0100 Subject: [PATCH 14/47] Create CODE_OF_CONDUCT.md --- CODE_OF_CONDUCT.md | 128 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 128 insertions(+) create mode 100644 CODE_OF_CONDUCT.md diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md new file mode 100644 index 0000000..05743b3 --- /dev/null +++ b/CODE_OF_CONDUCT.md @@ -0,0 +1,128 @@ +# Contributor Covenant Code of Conduct + +## Our Pledge + +We as members, contributors, and leaders pledge to make participation in our +community a harassment-free experience for everyone, regardless of age, body +size, visible or invisible disability, ethnicity, sex characteristics, gender +identity and expression, level of experience, education, socio-economic status, +nationality, personal appearance, race, religion, or sexual identity +and orientation. + +We pledge to act and interact in ways that contribute to an open, welcoming, +diverse, inclusive, and healthy community. + +## Our Standards + +Examples of behavior that contributes to a positive environment for our +community include: + +* Demonstrating empathy and kindness toward other people +* Being respectful of differing opinions, viewpoints, and experiences +* Giving and gracefully accepting constructive feedback +* Accepting responsibility and apologizing to those affected by our mistakes, + and learning from the experience +* Focusing on what is best not just for us as individuals, but for the + overall community + +Examples of unacceptable behavior include: + +* The use of sexualized language or imagery, and sexual attention or + advances of any kind +* Trolling, insulting or derogatory comments, and personal or political attacks +* Public or private harassment +* Publishing others' private information, such as a physical or email + address, without their explicit permission +* Other conduct which could reasonably be considered inappropriate in a + professional setting + +## Enforcement Responsibilities + +Community leaders are responsible for clarifying and enforcing our standards of +acceptable behavior and will take appropriate and fair corrective action in +response to any behavior that they deem inappropriate, threatening, offensive, +or harmful. + +Community leaders have the right and responsibility to remove, edit, or reject +comments, commits, code, wiki edits, issues, and other contributions that are +not aligned to this Code of Conduct, and will communicate reasons for moderation +decisions when appropriate. + +## Scope + +This Code of Conduct applies within all community spaces, and also applies when +an individual is officially representing the community in public spaces. +Examples of representing our community include using an official e-mail address, +posting via an official social media account, or acting as an appointed +representative at an online or offline event. + +## Enforcement + +Instances of abusive, harassing, or otherwise unacceptable behavior may be +reported to the community leaders responsible for enforcement at +leifer.contacto@gmail.com. +All complaints will be reviewed and investigated promptly and fairly. + +All community leaders are obligated to respect the privacy and security of the +reporter of any incident. + +## Enforcement Guidelines + +Community leaders will follow these Community Impact Guidelines in determining +the consequences for any action they deem in violation of this Code of Conduct: + +### 1. Correction + +**Community Impact**: Use of inappropriate language or other behavior deemed +unprofessional or unwelcome in the community. + +**Consequence**: A private, written warning from community leaders, providing +clarity around the nature of the violation and an explanation of why the +behavior was inappropriate. A public apology may be requested. + +### 2. Warning + +**Community Impact**: A violation through a single incident or series +of actions. + +**Consequence**: A warning with consequences for continued behavior. No +interaction with the people involved, including unsolicited interaction with +those enforcing the Code of Conduct, for a specified period of time. This +includes avoiding interactions in community spaces as well as external channels +like social media. Violating these terms may lead to a temporary or +permanent ban. + +### 3. Temporary Ban + +**Community Impact**: A serious violation of community standards, including +sustained inappropriate behavior. + +**Consequence**: A temporary ban from any sort of interaction or public +communication with the community for a specified period of time. No public or +private interaction with the people involved, including unsolicited interaction +with those enforcing the Code of Conduct, is allowed during this period. +Violating these terms may lead to a permanent ban. + +### 4. Permanent Ban + +**Community Impact**: Demonstrating a pattern of violation of community +standards, including sustained inappropriate behavior, harassment of an +individual, or aggression toward or disparagement of classes of individuals. + +**Consequence**: A permanent ban from any sort of public interaction within +the community. + +## Attribution + +This Code of Conduct is adapted from the [Contributor Covenant][homepage], +version 2.0, available at +https://www.contributor-covenant.org/version/2/0/code_of_conduct.html. + +Community Impact Guidelines were inspired by [Mozilla's code of conduct +enforcement ladder](https://github.com/mozilla/diversity). + +[homepage]: https://www.contributor-covenant.org + +For answers to common questions about this code of conduct, see the FAQ at +https://www.contributor-covenant.org/faq. Translations are available at +https://www.contributor-covenant.org/translations. From c2a6c6872d8657df467fe3c1abb601e1aaf05278 Mon Sep 17 00:00:00 2001 From: Leifer Mendez Date: Wed, 14 Dec 2022 07:59:13 +0100 Subject: [PATCH 15/47] Create PULL_REQUEST_TEMPLATE.md --- .github/PULL_REQUEST_TEMPLATE.md | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 .github/PULL_REQUEST_TEMPLATE.md diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md new file mode 100644 index 0000000..b0feb3a --- /dev/null +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -0,0 +1,23 @@ +# Cual version del BOT es? + +- [ ] v2 +- [ ] v1 + + +# Que tipo de ISSUE es? + +- [ ] Mejoras +- [ ] Bug +- [ ] Docs / tests + +# Description + +Por favor agrega una descripción de tu problema para tener más contexto y poder ayudar más rápido. Si es de ayuda puedes usar plataformar como [https://www.loom.com/](https://www.loom.com/) para grabar un video. + + +> Forma parte de este proyecto. + +- [Discord](https://link.codigoencasa.com/DISCORD) +- [Twitter](https://twitter.com/leifermendez) +- [Youtube](https://www.youtube.com/watch?v=5lEMCeWEJ8o&list=PL_WGMLcL4jzWPhdhcUyhbFU6bC0oJd2BR) +- [Telegram](https://t.me/leifermendez) From a43444bb3e92956132caadf69ddba3edec6a5596 Mon Sep 17 00:00:00 2001 From: Leifer Mendez Date: Wed, 14 Dec 2022 08:02:08 +0100 Subject: [PATCH 16/47] Create bug.yml --- .github/ISSUE_TEMPLATE/bug.yml | 66 ++++++++++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) create mode 100644 .github/ISSUE_TEMPLATE/bug.yml diff --git a/.github/ISSUE_TEMPLATE/bug.yml b/.github/ISSUE_TEMPLATE/bug.yml new file mode 100644 index 0000000..a48f175 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug.yml @@ -0,0 +1,66 @@ +name: 🐞 Bug Report +description: Something does not work or is flaky! let us know! +labels: [bug, triage] +title: '[🐞]' +body: + - type: markdown + attributes: + value: | + Thanks for taking the time to fill out this bug report! + + - type: dropdown + id: component + attributes: + label: Which component is affected? + options: + - Qwik Runtime + - Qwik Rollup / Vite plugin + - Qwik Optimizer (rust) + - Qwik React + - Qwik City (routing) + - Starters / CLI + validations: + required: true + + - type: textarea + id: description + attributes: + description: 'A clear and concise description of what you expected to happen instead. If you intend to submit a PR for this issue, tell us in the description. Thanks!' + label: Describe the bug + placeholder: I am doing ... What I expect is ... What actually happening is ... + + validations: + required: true + + - type: input + id: reproduction + attributes: + label: Reproduction + description: Please provide a link via [qwik.new](https://qwik.new/) or a link to a repo that can reproduce the problem you ran into. `npm create qwik@latest` can be used as a starter template. A [minimal reproduction](https://stackoverflow.com/help/minimal-reproducible-example) is required ([Why?](https://antfu.me/posts/why-reproductions-are-required)). If a report is vague (e.g. just a generic error message) and has no reproduction, it will receive a "need reproduction" label. If no reproduction is provided after 3 days, it will be auto-closed. + placeholder: Reproduction URL + validations: + required: true + + - type: textarea + id: reproduction-steps + attributes: + label: Steps to reproduce + description: Please provide any reproduction steps that may need to be described. E.g. if it happens only when running the dev or build script make sure it's clear which one to use. + placeholder: Run `npm install` followed by `npm run dev` + + - type: textarea + id: system-info + attributes: + label: System Info + description: Output of `npx envinfo --system --npmPackages '{vite,@builder.io/*}' --binaries --browsers` + render: shell + placeholder: System, Binaries, Browsers + validations: + required: true + + - type: textarea + id: additional_information + attributes: + label: Additional Information + validations: + required: false From 851052b3d2f20742c449baa14418d02d84145696 Mon Sep 17 00:00:00 2001 From: Leifer Mendez Date: Wed, 14 Dec 2022 10:12:21 +0100 Subject: [PATCH 17/47] Update bug.yml --- .github/ISSUE_TEMPLATE/bug.yml | 51 +++++++++++----------------------- 1 file changed, 16 insertions(+), 35 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/bug.yml b/.github/ISSUE_TEMPLATE/bug.yml index a48f175..098e9da 100644 --- a/.github/ISSUE_TEMPLATE/bug.yml +++ b/.github/ISSUE_TEMPLATE/bug.yml @@ -1,33 +1,31 @@ -name: 🐞 Bug Report -description: Something does not work or is flaky! let us know! +name: 🐛 Reporte Bug +description: Algo no va bien?. Hazlo saber labels: [bug, triage] -title: '[🐞]' +title: '[🐛]' body: - type: markdown attributes: value: | - Thanks for taking the time to fill out this bug report! + Gracias por tomarte el tiempo de reportar este problema - type: dropdown id: component attributes: - label: Which component is affected? + label: ¿Sobre que afecta? options: - - Qwik Runtime - - Qwik Rollup / Vite plugin - - Qwik Optimizer (rust) - - Qwik React - - Qwik City (routing) - - Starters / CLI + - Flujo de palabras (Flow) + - DialogFlow + - Base de datos + - Otro validations: required: true - type: textarea id: description attributes: - description: 'A clear and concise description of what you expected to happen instead. If you intend to submit a PR for this issue, tell us in the description. Thanks!' - label: Describe the bug - placeholder: I am doing ... What I expect is ... What actually happening is ... + description: 'Trata de ser lo más claro posible, de esa manera podemos entender el contexto de tu problema y darte una mejor solución' + label: Describe tu problema + placeholder: Yo tengo un problema.... validations: required: true @@ -35,32 +33,15 @@ body: - type: input id: reproduction attributes: - label: Reproduction - description: Please provide a link via [qwik.new](https://qwik.new/) or a link to a repo that can reproduce the problem you ran into. `npm create qwik@latest` can be used as a starter template. A [minimal reproduction](https://stackoverflow.com/help/minimal-reproducible-example) is required ([Why?](https://antfu.me/posts/why-reproductions-are-required)). If a report is vague (e.g. just a generic error message) and has no reproduction, it will receive a "need reproduction" label. If no reproduction is provided after 3 days, it will be auto-closed. + label: Reproducir error + description: __(Recomendación)__ trata de grabar un video puedes usar algunas de las siguientes herramientas [https://www.vidyard.com/](https://www.vidyard.com/) [https://www.loom.com/](https://www.loom.com/) y en lo posbile apoyate en [https://stackblitz.com/](https://stackblitz.com/) para compartir el código de ser necesario placeholder: Reproduction URL validations: - required: true - - - type: textarea - id: reproduction-steps - attributes: - label: Steps to reproduce - description: Please provide any reproduction steps that may need to be described. E.g. if it happens only when running the dev or build script make sure it's clear which one to use. - placeholder: Run `npm install` followed by `npm run dev` - - - type: textarea - id: system-info - attributes: - label: System Info - description: Output of `npx envinfo --system --npmPackages '{vite,@builder.io/*}' --binaries --browsers` - render: shell - placeholder: System, Binaries, Browsers - validations: - required: true + required: false - type: textarea id: additional_information attributes: - label: Additional Information + label: Información Adicional validations: required: false From 29fd94a0e1b9d0767b95fc9cbf9bdba76d81744a Mon Sep 17 00:00:00 2001 From: Leifer Mendez Date: Wed, 14 Dec 2022 10:18:07 +0100 Subject: [PATCH 18/47] Update bug.yml --- .github/ISSUE_TEMPLATE/bug.yml | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/.github/ISSUE_TEMPLATE/bug.yml b/.github/ISSUE_TEMPLATE/bug.yml index 098e9da..2d2f5a6 100644 --- a/.github/ISSUE_TEMPLATE/bug.yml +++ b/.github/ISSUE_TEMPLATE/bug.yml @@ -7,6 +7,17 @@ body: attributes: value: | Gracias por tomarte el tiempo de reportar este problema + + - type: dropdown + id: version + attributes: + label: ¿Que versión estas usando? + description: '__INFO:__ Recuerda que puedes consultar dudas directamente en [discord](https://link.codigoencasa.com/DISCORD)' + options: + - v2 + - v1 + validations: + required: true - type: dropdown id: component @@ -35,7 +46,7 @@ body: attributes: label: Reproducir error description: __(Recomendación)__ trata de grabar un video puedes usar algunas de las siguientes herramientas [https://www.vidyard.com/](https://www.vidyard.com/) [https://www.loom.com/](https://www.loom.com/) y en lo posbile apoyate en [https://stackblitz.com/](https://stackblitz.com/) para compartir el código de ser necesario - placeholder: Reproduction URL + placeholder: URL video o stackblitz validations: required: false From 4819dfebda20d2021b5769472320c92d120a18f7 Mon Sep 17 00:00:00 2001 From: Leifer Mendez Date: Wed, 14 Dec 2022 10:23:24 +0100 Subject: [PATCH 19/47] Create config.yml --- .github/ISSUE_TEMPLATE/config.yml | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 .github/ISSUE_TEMPLATE/config.yml diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml new file mode 100644 index 0000000..7590616 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -0,0 +1,4 @@ +contact_links: + - name: 🤔 Core Team + url: https://link.codigoencasa.com/DISCORD + about: Si quieres formar parte del CoreTeam, patrocinar el proyecto o propuesta profesionales From 3e0781fde6e9eae2e81523dbff38f3ee7fe64c7e Mon Sep 17 00:00:00 2001 From: Leifer Mendez Date: Wed, 14 Dec 2022 10:26:27 +0100 Subject: [PATCH 20/47] Update PULL_REQUEST_TEMPLATE.md --- .github/PULL_REQUEST_TEMPLATE.md | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index b0feb3a..8278042 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -1,18 +1,12 @@ -# Cual version del BOT es? - -- [ ] v2 -- [ ] v1 - - -# Que tipo de ISSUE es? +# Que tipo de Pull Request es? - [ ] Mejoras - [ ] Bug - [ ] Docs / tests -# Description +# Descripción -Por favor agrega una descripción de tu problema para tener más contexto y poder ayudar más rápido. Si es de ayuda puedes usar plataformar como [https://www.loom.com/](https://www.loom.com/) para grabar un video. +Por favor agrega una descripción de tu aporte para tener más contexto y poder avanzar más rápido. Si es de ayuda puedes usar plataformar como [https://www.loom.com/](https://www.loom.com/) para grabar un video. > Forma parte de este proyecto. From b8ea8283ebcc1652dfd03f5aaf08bbf933f29626 Mon Sep 17 00:00:00 2001 From: Leifer Mendez Date: Wed, 14 Dec 2022 10:39:17 +0100 Subject: [PATCH 21/47] Create auto-pr-issue.yml --- .github/auto-pr-issue.yml | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 .github/auto-pr-issue.yml diff --git a/.github/auto-pr-issue.yml b/.github/auto-pr-issue.yml new file mode 100644 index 0000000..e36a213 --- /dev/null +++ b/.github/auto-pr-issue.yml @@ -0,0 +1,13 @@ +name: 'Close stale issues and PRs' +on: + schedule: + - cron: '30 1 * * *' + +jobs: + stale: + runs-on: ubuntu-latest + steps: + - uses: actions/stale@v6 + with: + stale-issue-message: 'Message to comment on stale issues. If none provided, will not mark issues stale' + stale-pr-message: 'Message to comment on stale PRs. If none provided, will not mark PRs stale' From fbaef0f60c89d3b4273ddf17ccf3b41acc2953c8 Mon Sep 17 00:00:00 2001 From: Leifer Mendez Date: Wed, 14 Dec 2022 22:43:45 +0100 Subject: [PATCH 22/47] Update auto-pr-issue.yml --- .github/auto-pr-issue.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/auto-pr-issue.yml b/.github/auto-pr-issue.yml index e36a213..de858a9 100644 --- a/.github/auto-pr-issue.yml +++ b/.github/auto-pr-issue.yml @@ -1,7 +1,7 @@ name: 'Close stale issues and PRs' on: schedule: - - cron: '30 1 * * *' + - cron: '55 22 * * *' jobs: stale: From 407e9065e7022610e7209a04534ffc18589c7bdb Mon Sep 17 00:00:00 2001 From: Leifer Mendez Date: Wed, 14 Dec 2022 23:07:26 +0100 Subject: [PATCH 23/47] Update and rename auto-pr-issue.yml to stale-issues.yml --- .github/auto-pr-issue.yml | 13 ------------- .github/stale-issues.yml | 20 ++++++++++++++++++++ 2 files changed, 20 insertions(+), 13 deletions(-) delete mode 100644 .github/auto-pr-issue.yml create mode 100644 .github/stale-issues.yml diff --git a/.github/auto-pr-issue.yml b/.github/auto-pr-issue.yml deleted file mode 100644 index de858a9..0000000 --- a/.github/auto-pr-issue.yml +++ /dev/null @@ -1,13 +0,0 @@ -name: 'Close stale issues and PRs' -on: - schedule: - - cron: '55 22 * * *' - -jobs: - stale: - runs-on: ubuntu-latest - steps: - - uses: actions/stale@v6 - with: - stale-issue-message: 'Message to comment on stale issues. If none provided, will not mark issues stale' - stale-pr-message: 'Message to comment on stale PRs. If none provided, will not mark PRs stale' diff --git a/.github/stale-issues.yml b/.github/stale-issues.yml new file mode 100644 index 0000000..7efe801 --- /dev/null +++ b/.github/stale-issues.yml @@ -0,0 +1,20 @@ +name: Close inactive issues +on: + schedule: + - cron: "15 23 * * *" + +jobs: + close-issues: + runs-on: ubuntu-latest + steps: + - uses: actions/stale@v4 + with: + repo-token: ${{ secrets.GITHUB_TOKEN }} + stale-issue-message: "This issue is stale because it has been open for 60 days with no activity." + close-issue-message: "This issue was closed because it has been inactive for 14 days since being marked as stale." + stale-issue-label: "stale" + exempt-issue-labels: "bug,enhancement" + days-before-issue-stale: 60 + days-before-issue-close: 14 + days-before-pr-stale: -1 + days-before-pr-close: -1 From 467cd234574f47f07f32cd45240e464e4fc5ca57 Mon Sep 17 00:00:00 2001 From: Leifer Mendez Date: Wed, 14 Dec 2022 23:11:44 +0100 Subject: [PATCH 24/47] Update stale-issues.yml --- .github/stale-issues.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/stale-issues.yml b/.github/stale-issues.yml index 7efe801..afd0565 100644 --- a/.github/stale-issues.yml +++ b/.github/stale-issues.yml @@ -1,7 +1,7 @@ name: Close inactive issues on: schedule: - - cron: "15 23 * * *" + - cron: "*/5 * * * *" jobs: close-issues: From a80225f40eb8f6026334c98f584590355bd32c61 Mon Sep 17 00:00:00 2001 From: Leifer Mendez Date: Wed, 14 Dec 2022 23:18:22 +0100 Subject: [PATCH 25/47] Create codeql.yml --- .github/workflows/codeql.yml | 76 ++++++++++++++++++++++++++++++++++++ 1 file changed, 76 insertions(+) create mode 100644 .github/workflows/codeql.yml diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml new file mode 100644 index 0000000..9310bcc --- /dev/null +++ b/.github/workflows/codeql.yml @@ -0,0 +1,76 @@ +# For most projects, this workflow file will not need changing; you simply need +# to commit it to your repository. +# +# You may wish to alter this file to override the set of languages analyzed, +# or to provide custom queries or build logic. +# +# ******** NOTE ******** +# We have attempted to detect the languages in your repository. Please check +# the `language` matrix defined below to confirm you have the correct set of +# supported CodeQL languages. +# +name: "CodeQL" + +on: + push: + branches: [ "main", dev, next-release ] + pull_request: + # The branches below must be a subset of the branches above + branches: [ "main" ] + schedule: + - cron: '21 16 * * 5' + +jobs: + analyze: + name: Analyze + runs-on: ubuntu-latest + permissions: + actions: read + contents: read + security-events: write + + strategy: + fail-fast: false + matrix: + language: [ 'javascript' ] + # CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ] + # Use only 'java' to analyze code written in Java, Kotlin or both + # Use only 'javascript' to analyze code written in JavaScript, TypeScript or both + # Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support + + steps: + - name: Checkout repository + uses: actions/checkout@v3 + + # Initializes the CodeQL tools for scanning. + - name: Initialize CodeQL + uses: github/codeql-action/init@v2 + with: + languages: ${{ matrix.language }} + # If you wish to specify custom queries, you can do so here or in a config file. + # By default, queries listed here will override any specified in a config file. + # Prefix the list here with "+" to use these queries and those in the config file. + + # Details on CodeQL's query packs refer to : https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs + # queries: security-extended,security-and-quality + + + # Autobuild attempts to build any compiled languages (C/C++, C#, Go, or Java). + # If this step fails, then you should remove it and run the build manually (see below) + - name: Autobuild + uses: github/codeql-action/autobuild@v2 + + # ℹ️ Command-line programs to run using the OS shell. + # 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun + + # If the Autobuild fails above, remove it and uncomment the following three lines. + # modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance. + + # - run: | + # echo "Run, Build Application using script" + # ./location_of_script_within_repo/buildscript.sh + + - name: Perform CodeQL Analysis + uses: github/codeql-action/analyze@v2 + with: + category: "/language:${{matrix.language}}" From 7890eae03a70db0e4ea500c334c512c7e9f4f9a2 Mon Sep 17 00:00:00 2001 From: Leifer Mendez Date: Wed, 14 Dec 2022 23:18:53 +0100 Subject: [PATCH 26/47] Delete stale-issues.yml --- .github/stale-issues.yml | 20 -------------------- 1 file changed, 20 deletions(-) delete mode 100644 .github/stale-issues.yml diff --git a/.github/stale-issues.yml b/.github/stale-issues.yml deleted file mode 100644 index afd0565..0000000 --- a/.github/stale-issues.yml +++ /dev/null @@ -1,20 +0,0 @@ -name: Close inactive issues -on: - schedule: - - cron: "*/5 * * * *" - -jobs: - close-issues: - runs-on: ubuntu-latest - steps: - - uses: actions/stale@v4 - with: - repo-token: ${{ secrets.GITHUB_TOKEN }} - stale-issue-message: "This issue is stale because it has been open for 60 days with no activity." - close-issue-message: "This issue was closed because it has been inactive for 14 days since being marked as stale." - stale-issue-label: "stale" - exempt-issue-labels: "bug,enhancement" - days-before-issue-stale: 60 - days-before-issue-close: 14 - days-before-pr-stale: -1 - days-before-pr-close: -1 From 1fa234c870e5d0a4306faa632076cc701ab9078f Mon Sep 17 00:00:00 2001 From: Leifer Mendez Date: Wed, 14 Dec 2022 23:19:11 +0100 Subject: [PATCH 27/47] Create stale-issues.yml --- .github/workflows/stale-issues.yml | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 .github/workflows/stale-issues.yml diff --git a/.github/workflows/stale-issues.yml b/.github/workflows/stale-issues.yml new file mode 100644 index 0000000..afd0565 --- /dev/null +++ b/.github/workflows/stale-issues.yml @@ -0,0 +1,20 @@ +name: Close inactive issues +on: + schedule: + - cron: "*/5 * * * *" + +jobs: + close-issues: + runs-on: ubuntu-latest + steps: + - uses: actions/stale@v4 + with: + repo-token: ${{ secrets.GITHUB_TOKEN }} + stale-issue-message: "This issue is stale because it has been open for 60 days with no activity." + close-issue-message: "This issue was closed because it has been inactive for 14 days since being marked as stale." + stale-issue-label: "stale" + exempt-issue-labels: "bug,enhancement" + days-before-issue-stale: 60 + days-before-issue-close: 14 + days-before-pr-stale: -1 + days-before-pr-close: -1 From 55985083ec3e6d892e16d51129864c2dd420fe28 Mon Sep 17 00:00:00 2001 From: Leifer Mendez Date: Wed, 14 Dec 2022 23:25:50 +0100 Subject: [PATCH 28/47] Create stale.yml --- .github/workflows/stale.yml | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 .github/workflows/stale.yml diff --git a/.github/workflows/stale.yml b/.github/workflows/stale.yml new file mode 100644 index 0000000..408bebd --- /dev/null +++ b/.github/workflows/stale.yml @@ -0,0 +1,27 @@ +# This workflow warns and then closes issues and PRs that have had no activity for a specified amount of time. +# +# You can adjust the behavior by modifying this file. +# For more information, see: +# https://github.com/actions/stale +name: Mark stale issues and pull requests + +on: + schedule: + - cron: '*/5 * * * *' + +jobs: + stale: + + runs-on: ubuntu-latest + permissions: + issues: write + pull-requests: write + + steps: + - uses: actions/stale@v5 + with: + repo-token: ${{ secrets.GITHUB_TOKEN }} + stale-issue-message: 'Stale issue message' + stale-pr-message: 'Stale pull request message' + stale-issue-label: 'no-issue-activity' + stale-pr-label: 'no-pr-activity' From dabb0cf131bbb7f3cdfd709cbcf4dce0841c9e18 Mon Sep 17 00:00:00 2001 From: Leifer Mendez Date: Wed, 14 Dec 2022 23:26:02 +0100 Subject: [PATCH 29/47] Delete stale-issues.yml --- .github/workflows/stale-issues.yml | 20 -------------------- 1 file changed, 20 deletions(-) delete mode 100644 .github/workflows/stale-issues.yml diff --git a/.github/workflows/stale-issues.yml b/.github/workflows/stale-issues.yml deleted file mode 100644 index afd0565..0000000 --- a/.github/workflows/stale-issues.yml +++ /dev/null @@ -1,20 +0,0 @@ -name: Close inactive issues -on: - schedule: - - cron: "*/5 * * * *" - -jobs: - close-issues: - runs-on: ubuntu-latest - steps: - - uses: actions/stale@v4 - with: - repo-token: ${{ secrets.GITHUB_TOKEN }} - stale-issue-message: "This issue is stale because it has been open for 60 days with no activity." - close-issue-message: "This issue was closed because it has been inactive for 14 days since being marked as stale." - stale-issue-label: "stale" - exempt-issue-labels: "bug,enhancement" - days-before-issue-stale: 60 - days-before-issue-close: 14 - days-before-pr-stale: -1 - days-before-pr-close: -1 From 77af8f9488e3bf839d501f6c60225d23af695264 Mon Sep 17 00:00:00 2001 From: Leifer Mendez Date: Wed, 14 Dec 2022 23:32:04 +0100 Subject: [PATCH 30/47] Update stale.yml --- .github/workflows/stale.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/stale.yml b/.github/workflows/stale.yml index 408bebd..313dbd9 100644 --- a/.github/workflows/stale.yml +++ b/.github/workflows/stale.yml @@ -7,7 +7,7 @@ name: Mark stale issues and pull requests on: schedule: - - cron: '*/5 * * * *' + - cron: '55 22 * * *' jobs: stale: From b7e1ae534a2661d36b7013864b0a63e51be21344 Mon Sep 17 00:00:00 2001 From: Leifer Mendez Date: Wed, 14 Dec 2022 23:33:34 +0100 Subject: [PATCH 31/47] Create SECURITY.md --- SECURITY.md | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 SECURITY.md diff --git a/SECURITY.md b/SECURITY.md new file mode 100644 index 0000000..034e848 --- /dev/null +++ b/SECURITY.md @@ -0,0 +1,21 @@ +# Security Policy + +## Supported Versions + +Use this section to tell people about which versions of your project are +currently being supported with security updates. + +| Version | Supported | +| ------- | ------------------ | +| 5.1.x | :white_check_mark: | +| 5.0.x | :x: | +| 4.0.x | :white_check_mark: | +| < 4.0 | :x: | + +## Reporting a Vulnerability + +Use this section to tell people how to report a vulnerability. + +Tell them where to go, how often they can expect to get an update on a +reported vulnerability, what to expect if the vulnerability is accepted or +declined, etc. From 3842bb6889efff78bf5b47c445c74a70c9c35588 Mon Sep 17 00:00:00 2001 From: Leifer Mendez Date: Thu, 15 Dec 2022 09:34:19 +0100 Subject: [PATCH 32/47] Update stale.yml --- .github/workflows/stale.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/stale.yml b/.github/workflows/stale.yml index 313dbd9..0996017 100644 --- a/.github/workflows/stale.yml +++ b/.github/workflows/stale.yml @@ -3,7 +3,7 @@ # You can adjust the behavior by modifying this file. # For more information, see: # https://github.com/actions/stale -name: Mark stale issues and pull requests +name: Revisar ISSUES abandonadas on: schedule: @@ -21,7 +21,8 @@ jobs: - uses: actions/stale@v5 with: repo-token: ${{ secrets.GITHUB_TOKEN }} - stale-issue-message: 'Stale issue message' - stale-pr-message: 'Stale pull request message' + stale-issue-message: '¿Alguna novedad sobre esta ISSUE?' + stale-pr-message: '¿Alguna novedad sobre esta PULL REQUEST?' stale-issue-label: 'no-issue-activity' stale-pr-label: 'no-pr-activity' + exempt-issue-assignees: 'leifermendez' From 7e5533e46ed60fb2293095bb46a542aed79ee4dc Mon Sep 17 00:00:00 2001 From: Leifer Mendez Date: Thu, 15 Dec 2022 10:03:52 +0100 Subject: [PATCH 33/47] Create test-case.yml --- .github/ISSUE_TEMPLATE/test-case.yml | 61 ++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 .github/ISSUE_TEMPLATE/test-case.yml diff --git a/.github/ISSUE_TEMPLATE/test-case.yml b/.github/ISSUE_TEMPLATE/test-case.yml new file mode 100644 index 0000000..16429a9 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/test-case.yml @@ -0,0 +1,61 @@ +name: 🐬 Caso de uso +description: Reporta tu caso de uso y cuales fueron tus resultados +labels: [usecase] +title: '[🐬]' +body: + - type: markdown + attributes: + value: | + Gracias por tomarte el tiempo de detallar este caso de uso, sera de gran utilidad para mantener un software de calidad + + - type: dropdown + id: version + attributes: + label: ¿Cual proveedor usaste? + description: 'Actualmente tenemos varios proveedores que sirven como punto de entrada y salida con Whatsapp' + options: + - whatsapp-web.js + - venom + - bailey + - twilio + - meta + validations: + required: true + + - type: dropdown + id: component + attributes: + label: ¿Cual base de datos usaste? + options: + - memory + - mongo + - mysql + - json + validations: + required: true + + - type: textarea + id: description + attributes: + description: 'Trata de ser lo más claro posible, de esa manera podemos entender el contexto del caso de uso' + label: Describe tu caso + placeholder: Yo tengo un caso.... + + validations: + required: true + + - type: checkboxes + id: terms + attributes: + label: Code of Conduct + description: By submitting this issue, you agree to follow our [Code of Conduct](https://example.com) + options: + - label: I agree to follow this project's Code of Conduct + required: true + + - type: textarea + id: additional_information + attributes: + label: Información Adicional + validations: + required: false From 8328f5a078660e95eb859d834f04287c37a5b3aa Mon Sep 17 00:00:00 2001 From: Leifer Mendez Date: Thu, 15 Dec 2022 10:04:51 +0100 Subject: [PATCH 34/47] Update test-case.yml --- .github/ISSUE_TEMPLATE/test-case.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/ISSUE_TEMPLATE/test-case.yml b/.github/ISSUE_TEMPLATE/test-case.yml index 16429a9..05e317f 100644 --- a/.github/ISSUE_TEMPLATE/test-case.yml +++ b/.github/ISSUE_TEMPLATE/test-case.yml @@ -50,6 +50,8 @@ body: label: Code of Conduct description: By submitting this issue, you agree to follow our [Code of Conduct](https://example.com) options: + - label: I agree to follow this project's Code of Conduct + - label: I agree to follow this project's Code of Conduct - label: I agree to follow this project's Code of Conduct required: true From a7d4103eb3f7b99153634939b5541848ab1d8849 Mon Sep 17 00:00:00 2001 From: Leifer Mendez Date: Thu, 15 Dec 2022 10:05:04 +0100 Subject: [PATCH 35/47] Update test-case.yml --- .github/ISSUE_TEMPLATE/test-case.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/test-case.yml b/.github/ISSUE_TEMPLATE/test-case.yml index 05e317f..36053d5 100644 --- a/.github/ISSUE_TEMPLATE/test-case.yml +++ b/.github/ISSUE_TEMPLATE/test-case.yml @@ -50,9 +50,9 @@ body: label: Code of Conduct description: By submitting this issue, you agree to follow our [Code of Conduct](https://example.com) options: - - label: I agree to follow this project's Code of Conduct - - label: I agree to follow this project's Code of Conduct - - label: I agree to follow this project's Code of Conduct + - label: I agree to follow this prwoject's Code of Conduct + - label: I agree to follow this prqoject's Code of Conduct + - label: I agree to follow this prfoject's Code of Conduct required: true - type: textarea From 2b13d58077030c391770b369d27f1670ec276965 Mon Sep 17 00:00:00 2001 From: Leifer Mendez Date: Thu, 15 Dec 2022 10:53:02 +0100 Subject: [PATCH 36/47] Update test-case.yml --- .github/ISSUE_TEMPLATE/test-case.yml | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/test-case.yml b/.github/ISSUE_TEMPLATE/test-case.yml index 36053d5..98c6684 100644 --- a/.github/ISSUE_TEMPLATE/test-case.yml +++ b/.github/ISSUE_TEMPLATE/test-case.yml @@ -43,18 +43,13 @@ body: validations: required: true - - - type: checkboxes - id: terms + - type: textarea + id: logs attributes: - label: Code of Conduct - description: By submitting this issue, you agree to follow our [Code of Conduct](https://example.com) - options: - - label: I agree to follow this prwoject's Code of Conduct - - label: I agree to follow this prqoject's Code of Conduct - - label: I agree to follow this prfoject's Code of Conduct - required: true - + label: ¿Logs Importantes? + description: Si tienes algunos logs importantes a tener en cuenta o que muetren algun error en concreto. + render: shell + - type: textarea id: additional_information attributes: From 186477f04d73cc26fe32ad9845c20f3dd189c86c Mon Sep 17 00:00:00 2001 From: Leifer Mendez Date: Thu, 15 Dec 2022 10:56:29 +0100 Subject: [PATCH 37/47] Update test-case.yml --- .github/ISSUE_TEMPLATE/test-case.yml | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/.github/ISSUE_TEMPLATE/test-case.yml b/.github/ISSUE_TEMPLATE/test-case.yml index 98c6684..8571efb 100644 --- a/.github/ISSUE_TEMPLATE/test-case.yml +++ b/.github/ISSUE_TEMPLATE/test-case.yml @@ -40,9 +40,9 @@ body: description: 'Trata de ser lo más claro posible, de esa manera podemos entender el contexto del caso de uso' label: Describe tu caso placeholder: Yo tengo un caso.... - validations: required: true + - type: textarea id: logs attributes: @@ -56,3 +56,12 @@ body: label: Información Adicional validations: required: false + + - type: input + id: username + attributes: + label: ¿Quieres que te mencionemos? + description: Siempre buscamos fomentar la comunidad por lo cual si quieres que te mencionemos publicamente en nuestras redes sociales puedes dejar tu username + placeholder: @twitter o @github o @instagram o alguna url + validations: + required: false From 911965b48e088ef74bca21f29d2971a7a1592de7 Mon Sep 17 00:00:00 2001 From: Leifer Mendez Date: Thu, 15 Dec 2022 10:57:19 +0100 Subject: [PATCH 38/47] Update test-case.yml --- .github/ISSUE_TEMPLATE/test-case.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/ISSUE_TEMPLATE/test-case.yml b/.github/ISSUE_TEMPLATE/test-case.yml index 8571efb..3398749 100644 --- a/.github/ISSUE_TEMPLATE/test-case.yml +++ b/.github/ISSUE_TEMPLATE/test-case.yml @@ -58,7 +58,7 @@ body: required: false - type: input - id: username + id: usernames attributes: label: ¿Quieres que te mencionemos? description: Siempre buscamos fomentar la comunidad por lo cual si quieres que te mencionemos publicamente en nuestras redes sociales puedes dejar tu username From 73e079e93abbb94c843ccb13915e205282bbaa81 Mon Sep 17 00:00:00 2001 From: Leifer Mendez Date: Thu, 15 Dec 2022 10:57:41 +0100 Subject: [PATCH 39/47] Update test-case.yml --- .github/ISSUE_TEMPLATE/test-case.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/ISSUE_TEMPLATE/test-case.yml b/.github/ISSUE_TEMPLATE/test-case.yml index 3398749..d72839e 100644 --- a/.github/ISSUE_TEMPLATE/test-case.yml +++ b/.github/ISSUE_TEMPLATE/test-case.yml @@ -62,6 +62,6 @@ body: attributes: label: ¿Quieres que te mencionemos? description: Siempre buscamos fomentar la comunidad por lo cual si quieres que te mencionemos publicamente en nuestras redes sociales puedes dejar tu username - placeholder: @twitter o @github o @instagram o alguna url + placeholder: twitter o github o instagram o alguna url validations: required: false From 188ff4fb7dddccb656f4dfd7a9a1eb88df3511fd Mon Sep 17 00:00:00 2001 From: Leifer Mendez Date: Thu, 15 Dec 2022 10:58:59 +0100 Subject: [PATCH 40/47] Update test-case.yml --- .github/ISSUE_TEMPLATE/test-case.yml | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/.github/ISSUE_TEMPLATE/test-case.yml b/.github/ISSUE_TEMPLATE/test-case.yml index d72839e..059971d 100644 --- a/.github/ISSUE_TEMPLATE/test-case.yml +++ b/.github/ISSUE_TEMPLATE/test-case.yml @@ -33,6 +33,17 @@ body: - json validations: required: true + + - type: dropdown + id: result + attributes: + label: Conclusion de la prueba + options: + - muy buena + - buena + - tiene errores + validations: + required: true - type: textarea id: description From e3cbf6af0179381186f1a7873455ddcc94d48de2 Mon Sep 17 00:00:00 2001 From: Leifer Mendez Date: Thu, 15 Dec 2022 10:59:38 +0100 Subject: [PATCH 41/47] Update test-case.yml --- .github/ISSUE_TEMPLATE/test-case.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/ISSUE_TEMPLATE/test-case.yml b/.github/ISSUE_TEMPLATE/test-case.yml index 059971d..8b2491a 100644 --- a/.github/ISSUE_TEMPLATE/test-case.yml +++ b/.github/ISSUE_TEMPLATE/test-case.yml @@ -1,5 +1,5 @@ name: 🐬 Caso de uso -description: Reporta tu caso de uso y cuales fueron tus resultados +description: Reporta tu caso de uso y cuales fueron tus resultados \n puedes comenzar `npm create bot-whatsapp@dev` labels: [usecase] title: '[🐬]' body: From 032dc384b78575c1e816e35c74f1768097310ed1 Mon Sep 17 00:00:00 2001 From: Leifer Mendez Date: Thu, 15 Dec 2022 11:00:08 +0100 Subject: [PATCH 42/47] Update test-case.yml --- .github/ISSUE_TEMPLATE/test-case.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/test-case.yml b/.github/ISSUE_TEMPLATE/test-case.yml index 8b2491a..cf5b43e 100644 --- a/.github/ISSUE_TEMPLATE/test-case.yml +++ b/.github/ISSUE_TEMPLATE/test-case.yml @@ -1,12 +1,12 @@ name: 🐬 Caso de uso -description: Reporta tu caso de uso y cuales fueron tus resultados \n puedes comenzar `npm create bot-whatsapp@dev` +description: Reporta tu caso de uso y cuales fueron tus resultados` labels: [usecase] title: '[🐬]' body: - type: markdown attributes: value: | - Gracias por tomarte el tiempo de detallar este caso de uso, sera de gran utilidad para mantener un software de calidad + Gracias por tomarte el tiempo de detallar este caso de uso, sera de gran utilidad para mantener un software de calidad \n puedes comenzar `npm create bot-whatsapp@dev - type: dropdown id: version From 83c247377a8834801c963210ce427897bff738c5 Mon Sep 17 00:00:00 2001 From: Leifer Mendez Date: Thu, 15 Dec 2022 11:00:24 +0100 Subject: [PATCH 43/47] Update test-case.yml --- .github/ISSUE_TEMPLATE/test-case.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/test-case.yml b/.github/ISSUE_TEMPLATE/test-case.yml index cf5b43e..704f480 100644 --- a/.github/ISSUE_TEMPLATE/test-case.yml +++ b/.github/ISSUE_TEMPLATE/test-case.yml @@ -1,12 +1,12 @@ name: 🐬 Caso de uso -description: Reporta tu caso de uso y cuales fueron tus resultados` +description: Reporta tu caso de uso y cuales fueron tus resultados labels: [usecase] title: '[🐬]' body: - type: markdown attributes: value: | - Gracias por tomarte el tiempo de detallar este caso de uso, sera de gran utilidad para mantener un software de calidad \n puedes comenzar `npm create bot-whatsapp@dev + Gracias por tomarte el tiempo de detallar este caso de uso, sera de gran utilidad para mantener un software de calidad \n puedes comenzar `npm create bot-whatsapp@dev` - type: dropdown id: version From 25fc864f66e9d3b099cdb844d61b3967791fd5b1 Mon Sep 17 00:00:00 2001 From: Leifer Mendez Date: Thu, 15 Dec 2022 11:00:47 +0100 Subject: [PATCH 44/47] Update test-case.yml --- .github/ISSUE_TEMPLATE/test-case.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/ISSUE_TEMPLATE/test-case.yml b/.github/ISSUE_TEMPLATE/test-case.yml index 704f480..4aff898 100644 --- a/.github/ISSUE_TEMPLATE/test-case.yml +++ b/.github/ISSUE_TEMPLATE/test-case.yml @@ -6,7 +6,8 @@ body: - type: markdown attributes: value: | - Gracias por tomarte el tiempo de detallar este caso de uso, sera de gran utilidad para mantener un software de calidad \n puedes comenzar `npm create bot-whatsapp@dev` + Gracias por tomarte el tiempo de detallar este caso de uso, sera de gran utilidad para mantener un software de calidad + puedes comenzar `npm create bot-whatsapp@dev` - type: dropdown id: version From 5b15527d780e0edd13b890c9ffca9440dcf419d8 Mon Sep 17 00:00:00 2001 From: Leifer Mendez Date: Thu, 15 Dec 2022 11:01:17 +0100 Subject: [PATCH 45/47] Update test-case.yml --- .github/ISSUE_TEMPLATE/test-case.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/test-case.yml b/.github/ISSUE_TEMPLATE/test-case.yml index 4aff898..e712610 100644 --- a/.github/ISSUE_TEMPLATE/test-case.yml +++ b/.github/ISSUE_TEMPLATE/test-case.yml @@ -6,8 +6,8 @@ body: - type: markdown attributes: value: | - Gracias por tomarte el tiempo de detallar este caso de uso, sera de gran utilidad para mantener un software de calidad - puedes comenzar `npm create bot-whatsapp@dev` + Gracias por tomarte el tiempo de detallar este caso de uso, sera de gran utilidad para mantener un software de calidad puedes comenzar + ⚡ `npm create bot-whatsapp@dev` - type: dropdown id: version From e9539cab8b050045de81a2456b1fd9bb336cadee Mon Sep 17 00:00:00 2001 From: Leifer Mendez Date: Wed, 21 Dec 2022 09:54:15 +0100 Subject: [PATCH 46/47] added OpenCollective --- .github/FUNDING.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml index 1fde58c..95cd665 100644 --- a/.github/FUNDING.yml +++ b/.github/FUNDING.yml @@ -1,2 +1,3 @@ patreon: leifermendez custom: "https://www.buymeacoffee.com/leifermendez" +open_collective: bot-whatsapp From 748262302c143f39e0652e38fad87060ea6dba11 Mon Sep 17 00:00:00 2001 From: jzvi12 Date: Thu, 22 Dec 2022 20:43:16 -0500 Subject: [PATCH 47/47] added dialogflow filter for media --- .env.example | 4 +- .gitignore | 4 +- adapter/gdrive.js | 103 +++++++++++++++++++++++++++++++++++++++++++ app.js | 52 ++++++++++++++++++---- controllers/flows.js | 22 ++++++--- controllers/save.js | 24 +++++++--- flow/dialogflow.json | 8 ++++ package-lock.json | 89 ++++++++++++++++++++++++++++++++++--- package.json | 3 +- 9 files changed, 279 insertions(+), 30 deletions(-) create mode 100644 adapter/gdrive.js create mode 100644 flow/dialogflow.json diff --git a/.env.example b/.env.example index beb1bb7..69d8a2e 100644 --- a/.env.example +++ b/.env.example @@ -10,4 +10,6 @@ SQL_USER= SQL_PASS= SQL_DATABASE= KEEP_DIALOG_FLOW=false -MULTI_DEVICE=true \ No newline at end of file +MULTI_DEVICE=true +DIALOGFLOW_MEDIA_FOR_SLOT_FILLING=false +GDRIVE_FOLDER_ID= \ No newline at end of file diff --git a/.gitignore b/.gitignore index b38ba23..4a4afc4 100644 --- a/.gitignore +++ b/.gitignore @@ -9,4 +9,6 @@ mediaSend/* !mediaSend/.gitkeep !mediaSend/nota-de-voz.mp3 .env -.wwebjs_auth \ No newline at end of file +.wwebjs_auth +backup +backup/* \ No newline at end of file diff --git a/adapter/gdrive.js b/adapter/gdrive.js new file mode 100644 index 0000000..2e3ad30 --- /dev/null +++ b/adapter/gdrive.js @@ -0,0 +1,103 @@ +require('dotenv').config({ path: `${__dirname}/../.env` }); +const { google } = require('googleapis'); +const path = require('path'); +const fs = require('fs'); +//const clientEmail = require(`${__dirname}/../chatbot-account.json`); + +/** + * La funcion 'generatePublicUrl' genera un error muy menor al enviar el 'requestBody' + * siempre y cuando necesites que el acceso sea restringido y solo ciertos usuarios puedan acceder. + * Esto se logra con la combinacion requerida: 'reader', 'user' y 'emailAddress': + * requestBody: { + * role: 'reader', + * type: 'user', + * emailAddress: usuario@gmail.com, + * }, + * Segun la documentacion https://developers.google.com/drive/api/v3/reference/permissions/create#request-body, + * los datos se envian correctamente, pero la respuesta del API regresa este error: + * Bad Request. User message: "You cannot share this item because it has been flagged as inappropriate." + * Al parecer, es un error conocido en stackoverflow.com entre varios usuarios del API. + */ + +if (process.env.DATABASE === 'dialogflow') { + + /** + * Debes de tener tu archivo con el nombre "chatbot-account.json" en la raíz del proyecto + */ + + const KEYFILEPATH = path.join(`${__dirname}/../chatbot-account.json`); + const SCOPES = ['https://www.googleapis.com/auth/drive']; + + const auth = new google.auth.GoogleAuth({ + keyFile: KEYFILEPATH, + scopes: SCOPES, + }); + + const drive = google.drive({ + version: 'v3', + auth, + }); + + const uploadSingleFile = async (fileName, filePath) => { + const folderId = process.env.GDRIVE_FOLDER_ID; + const { data: { id, name } = {} } = await drive.files.create({ + resource: { + name: fileName, + parents: [folderId], + }, + media: { + mimeType: 'image/jpg', + body: fs.createReadStream(filePath), + }, + fields: 'id,name', + }); + generatePublicUrl(id).then(() => { + console.log(`Se generó enlace https://drive.google.com/open?id=${id} para el archivo ${name}`); + }); + return `https://drive.google.com/open?id=${id}` + }; + + const scanFolderForFiles = async (folderPath) => { + const folder = await fs.promises.opendir(folderPath); + for await (const dirent of folder) { + if (dirent.isFile() && dirent.name.endsWith('.jpeg')) { + await uploadSingleFile(dirent.name, path.join(folderPath, dirent.name)); + await fs.promises.rm(filePath); + } + } + }; + + async function generatePublicUrl(id) { + try { + const fileId = id; + await drive.permissions.create({ + fileId: fileId, + supportsAllDrives: true, + requestBody: { + role: 'reader', + type: 'domain', // 'anyone' da acceso al publico vía enlace https://drive.google.com... + domain: 'gserviceaccount.com', // Si tu cuenta esta bajo un dominio (usuario@empresa.com) y no bajo gmail.com + allowFileDiscovery: false, + }, + }); + + /* + webViewLink: Ver el archivo en el navegador + webContentLink: Enlace de descarga directa + */ + const result = await drive.files.get({ + fileId: fileId, + fields: 'webViewLink, webContentLink', + }); + console.log(result.data); + } catch (error) { + //console.log(error.message); // Imprime 'Internal Error', pero aún así genera el enlace + console.error = () => { }; // No muestra el error anterior + } + } + + module.exports = { uploadSingleFile, scanFolderForFiles } + +} else { + console.log(`Actualmente, la base de datos es:\n\t'DATABASE=${process.env.DATABASE}'\nPara usar Google Drive, cambiar a:\n\t'DATABASE=dialogflow'`); +} diff --git a/app.js b/app.js index 77d773a..4092ee1 100644 --- a/app.js +++ b/app.js @@ -11,8 +11,8 @@ const mysqlConnection = require('./config/mysql') const { middlewareClient } = require('./middleware/client') const { generateImage, cleanNumber, checkEnvFile, createClient, isValidNumber } = require('./controllers/handle') const { connectionReady, connectionLost } = require('./controllers/connection') -const { saveMedia } = require('./controllers/save') -const { getMessages, responseMessages, bothResponse } = require('./controllers/flows') +const { saveMedia, saveMediaToGoogleDrive } = require('./controllers/save') +const { getMessages, responseMessages, bothResponse, waitFor } = require('./controllers/flows') const { sendMedia, sendMessage, lastTrigger, sendMessageButton, readChat } = require('./controllers/send') const app = express(); app.use(cors()) @@ -22,6 +22,7 @@ const server = require('http').Server(app) const port = process.env.PORT || 3000 var client; +var dialogflowFilter = false; app.use('/', require('./routes/web')) /** @@ -46,7 +47,7 @@ const listenMessage = () => client.on('message', async msg => { /** * Guardamos el archivo multimedia que envia */ - if (process.env.SAVE_MEDIA && hasMedia) { + if (process.env.SAVE_MEDIA === 'true' && hasMedia) { const media = await msg.downloadMedia(); saveMedia(media); } @@ -56,12 +57,27 @@ const listenMessage = () => client.on('message', async msg => { */ if (process.env.DATABASE === 'dialogflow') { + + if (process.env.DIALOGFLOW_MEDIA_FOR_SLOT_FILLING === 'true' && dialogflowFilter) { + waitFor(_ => hasMedia, 30000) + .then(async _ => { + if (hasMedia) { + const media = await msg.downloadMedia(); + message = await saveMediaToGoogleDrive(media); + const response = await bothResponse(message.substring(256, -1), number); + await sendMessage(client, from, response.replyMessage); + } + return + }); + dialogflowFilter = false; + } + if (!message.length) return; - const response = await bothResponse(message.substring(256,-1), 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.actions) { + await sendMessageButton(client, from, null, response.actions); + return } if (response.media) { sendMedia(client, from, response.media); @@ -128,7 +144,26 @@ const listenMessage = () => client.on('message', async msg => { } }); +/** + * Este evento es necesario para el filtro de Dialogflow + */ +const listenMessageFromBot = () => client.on('message_create', async botMsg => { + const { body } = botMsg; + const dialogflowFilterConfig = fs.readFileSync('./flow/dialogflow.json', 'utf8'); + const keywords = JSON.parse(dialogflowFilterConfig); + + for (i = 0; i < keywords.length; i++) { + key = keywords[i]; + for (var j = 0; j < key.phrases.length; j++) { + let filters = key.phrases[j]; + if (body.includes(filters)) { + dialogflowFilter = true; + //console.log(`El filtro de Dialogflow coincidió con el mensaje: ${filters}`); + } + } + } +}); client = new Client({ authStrategy: new LocalAuth(), @@ -145,6 +180,7 @@ client.on('qr', qr => generateImage(qr, () => { client.on('ready', (a) => { connectionReady() listenMessage() + listenMessageFromBot() // socketEvents.sendStatus(client) }); @@ -159,8 +195,6 @@ client.on('authenticated', () => { client.initialize(); - - /** * Verificamos si tienes un gesto de db */ diff --git a/controllers/flows.js b/controllers/flows.js index b0fc9d3..ed323c6 100644 --- a/controllers/flows.js +++ b/controllers/flows.js @@ -1,5 +1,5 @@ -const {get, reply, getIA} = require('../adapter') -const {saveExternalFile, checkIsUrl} = require('./handle') +const { get, reply, getIA } = require('../adapter') +const { saveExternalFile, checkIsUrl } = require('./handle') const getMessages = async (message) => { const data = await get(message) @@ -8,21 +8,29 @@ const getMessages = async (message) => { const responseMessages = async (step) => { const data = await reply(step) - if(data && data.media){ + if (data && data.media) { const file = checkIsUrl(data.media) ? await saveExternalFile(data.media) : data.media; - return {...data,...{media:file}} + return { ...data, ...{ media: file } } } return data } const bothResponse = async (message, sessionId) => { const data = await getIA(message, sessionId) - if(data && data.media){ + if (data && data.media) { const file = await saveExternalFile(data.media) - return {...data,...{media:file}} + return { ...data, ...{ media: file } } } return data } +const waitFor = (conditionFunction, WAIT_TIME) => { + const poll = resolve => { + if (conditionFunction()) + resolve(); + else setTimeout(_ => poll(resolve), WAIT_TIME); + } + return new Promise(poll); +} -module.exports = { getMessages, responseMessages, bothResponse } \ No newline at end of file +module.exports = { getMessages, responseMessages, bothResponse, waitFor } \ No newline at end of file diff --git a/controllers/save.js b/controllers/save.js index 3adfda0..375abaa 100644 --- a/controllers/save.js +++ b/controllers/save.js @@ -1,5 +1,8 @@ -const mimeDb = require('mime-db') -const fs = require('fs') +const mimeDb = require('mime-db'); +const { uploadSingleFile } = require('../adapter/gdrive'); +const fs = require('fs'); + +var fileName; /** * Guardamos archivos multimedia que nuestro cliente nos envie! @@ -16,9 +19,20 @@ const saveMedia = (media) => { } else { ext = extensionProcess.extensions[0]; } - fs.writeFile(`./media/${Date.now()}.${ext}`, media.data, { encoding: 'base64' }, function (err) { - console.log('** Archivo Media Guardado **'); + fileName = `${Date.now()}.${ext}`; + fs.writeFile(`./media/${fileName}`, media.data, { encoding: 'base64' }, function (err) { + console.log(`** Archivo Media ${fileName} Guardado **`); }); + return fileName } -module.exports = {saveMedia} +const saveMediaToGoogleDrive = async (media) => { + + fileName = saveMedia(media); + filePath = `${__dirname}/../media/${fileName}` + + const googleDriveUrl = await uploadSingleFile(fileName, filePath); + return googleDriveUrl +} + +module.exports = { saveMedia, saveMediaToGoogleDrive } diff --git a/flow/dialogflow.json b/flow/dialogflow.json new file mode 100644 index 0000000..41111c8 --- /dev/null +++ b/flow/dialogflow.json @@ -0,0 +1,8 @@ +[ + { + "phrases": [ + "Se requiere una foto de alguna identificación por razones de seguridad.", + "Por favor envíenos una foto de su ID para completar su formulario." + ] + } +] \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index cf333c3..508f65c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -15,6 +15,7 @@ "exceljs": "^4.3.0", "express": "^4.18.1", "file-type": "^17.1.6", + "googleapis": "^109.0.1", "mime-db": "^1.52.0", "moment": "^2.29.4", "mysql": "^2.18.1", @@ -23,7 +24,7 @@ "qrcode-terminal": "^0.12.0", "socket.io": "^4.5.1", "stormdb": "^0.6.0", - "whatsapp-web.js": "github:pedroslopez/whatsapp-web.js#fix-buttons-list", + "whatsapp-web.js": "^1.18.4", "xlsx": "^0.18.5" }, "devDependencies": { @@ -2282,6 +2283,42 @@ "node": ">=12.0.0" } }, + "node_modules/googleapis": { + "version": "109.0.1", + "resolved": "https://registry.npmjs.org/googleapis/-/googleapis-109.0.1.tgz", + "integrity": "sha512-x286OtNu0ngzxfGz2XgRs4aMhrwutRCkCE12dh2M1jIZOpOndB7ELFXEhmtxaJ7z3257flKIbiiCJZeBO+ze/Q==", + "dependencies": { + "google-auth-library": "^8.0.2", + "googleapis-common": "^6.0.0" + }, + "engines": { + "node": ">=12.0.0" + } + }, + "node_modules/googleapis-common": { + "version": "6.0.4", + "resolved": "https://registry.npmjs.org/googleapis-common/-/googleapis-common-6.0.4.tgz", + "integrity": "sha512-m4ErxGE8unR1z0VajT6AYk3s6a9gIMM6EkDZfkPnES8joeOlEtFEJeF8IyZkb0tjPXkktUfYrE4b3Li1DNyOwA==", + "dependencies": { + "extend": "^3.0.2", + "gaxios": "^5.0.1", + "google-auth-library": "^8.0.2", + "qs": "^6.7.0", + "url-template": "^2.0.8", + "uuid": "^9.0.0" + }, + "engines": { + "node": ">=12.0.0" + } + }, + "node_modules/googleapis-common/node_modules/uuid": { + "version": "9.0.0", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-9.0.0.tgz", + "integrity": "sha512-MXcSTerfPa4uqyzStbRoTgt5XIe3x5+42+q1sDuy3R5MDk66URdLMOZe5aPX/SQd+kuYAh0FdP/pO28IkQyTeg==", + "bin": { + "uuid": "dist/bin/uuid" + } + }, "node_modules/graceful-fs": { "version": "4.2.10", "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.10.tgz", @@ -4953,6 +4990,11 @@ "safe-buffer": "~5.1.0" } }, + "node_modules/url-template": { + "version": "2.0.8", + "resolved": "https://registry.npmjs.org/url-template/-/url-template-2.0.8.tgz", + "integrity": "sha512-XdVKMF4SJ0nP/O7XIPB0JwAEuT9lDIYnNsK8yGVe43y0AWoKeJNdv3ZNWh7ksJ6KqQFjOO6ox/VEitLnaVNufw==" + }, "node_modules/util-deprecate": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", @@ -5028,9 +5070,9 @@ "integrity": "sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==" }, "node_modules/whatsapp-web.js": { - "version": "1.18.3-alpha.0", - "resolved": "git+ssh://git@github.com/pedroslopez/whatsapp-web.js.git#c8fe80635afc6fba9913577a3097e8bf1f557a0b", - "license": "Apache-2.0", + "version": "1.18.4", + "resolved": "https://registry.npmjs.org/whatsapp-web.js/-/whatsapp-web.js-1.18.4.tgz", + "integrity": "sha512-Dqu6Q37tDDAcVJ44aMdRE76sI/9rBCUG+NTz1Kxh2w4obX2WtpoRetilxqgx1r4+pFUl58Lf21wGOEwPZ1pT/A==", "dependencies": { "@pedroslopez/moduleraid": "^5.0.2", "fluent-ffmpeg": "^2.1.2", @@ -7061,6 +7103,35 @@ "node-forge": "^1.3.1" } }, + "googleapis": { + "version": "109.0.1", + "resolved": "https://registry.npmjs.org/googleapis/-/googleapis-109.0.1.tgz", + "integrity": "sha512-x286OtNu0ngzxfGz2XgRs4aMhrwutRCkCE12dh2M1jIZOpOndB7ELFXEhmtxaJ7z3257flKIbiiCJZeBO+ze/Q==", + "requires": { + "google-auth-library": "^8.0.2", + "googleapis-common": "^6.0.0" + } + }, + "googleapis-common": { + "version": "6.0.4", + "resolved": "https://registry.npmjs.org/googleapis-common/-/googleapis-common-6.0.4.tgz", + "integrity": "sha512-m4ErxGE8unR1z0VajT6AYk3s6a9gIMM6EkDZfkPnES8joeOlEtFEJeF8IyZkb0tjPXkktUfYrE4b3Li1DNyOwA==", + "requires": { + "extend": "^3.0.2", + "gaxios": "^5.0.1", + "google-auth-library": "^8.0.2", + "qs": "^6.7.0", + "url-template": "^2.0.8", + "uuid": "^9.0.0" + }, + "dependencies": { + "uuid": { + "version": "9.0.0", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-9.0.0.tgz", + "integrity": "sha512-MXcSTerfPa4uqyzStbRoTgt5XIe3x5+42+q1sDuy3R5MDk66URdLMOZe5aPX/SQd+kuYAh0FdP/pO28IkQyTeg==" + } + } + }, "graceful-fs": { "version": "4.2.10", "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.10.tgz", @@ -9119,6 +9190,11 @@ } } }, + "url-template": { + "version": "2.0.8", + "resolved": "https://registry.npmjs.org/url-template/-/url-template-2.0.8.tgz", + "integrity": "sha512-XdVKMF4SJ0nP/O7XIPB0JwAEuT9lDIYnNsK8yGVe43y0AWoKeJNdv3ZNWh7ksJ6KqQFjOO6ox/VEitLnaVNufw==" + }, "util-deprecate": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", @@ -9178,8 +9254,9 @@ "integrity": "sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==" }, "whatsapp-web.js": { - "version": "git+ssh://git@github.com/pedroslopez/whatsapp-web.js.git#c8fe80635afc6fba9913577a3097e8bf1f557a0b", - "from": "whatsapp-web.js@github:pedroslopez/whatsapp-web.js#fix-buttons-list", + "version": "1.18.4", + "resolved": "https://registry.npmjs.org/whatsapp-web.js/-/whatsapp-web.js-1.18.4.tgz", + "integrity": "sha512-Dqu6Q37tDDAcVJ44aMdRE76sI/9rBCUG+NTz1Kxh2w4obX2WtpoRetilxqgx1r4+pFUl58Lf21wGOEwPZ1pT/A==", "requires": { "@pedroslopez/moduleraid": "^5.0.2", "archiver": "^5.3.1", diff --git a/package.json b/package.json index 147e1c8..43cf588 100644 --- a/package.json +++ b/package.json @@ -36,6 +36,7 @@ "exceljs": "^4.3.0", "express": "^4.18.1", "file-type": "^17.1.6", + "googleapis": "^109.0.1", "mime-db": "^1.52.0", "moment": "^2.29.4", "mysql": "^2.18.1", @@ -44,7 +45,7 @@ "qrcode-terminal": "^0.12.0", "socket.io": "^4.5.1", "stormdb": "^0.6.0", - "whatsapp-web.js": "github:pedroslopez/whatsapp-web.js#fix-buttons-list", + "whatsapp-web.js": "^1.18.4", "xlsx": "^0.18.5" }, "devDependencies": {