From c1a739395b7de1c899f60942486e0e679585a292 Mon Sep 17 00:00:00 2001 From: adriano Date: Mon, 10 Apr 2023 17:50:02 -0300 Subject: [PATCH] =?UTF-8?q?Corre=C3=A7=C3=A3o=20da=20numera=C3=A7=C3=A3o?= =?UTF-8?q?=20automatica=20das=20sess=C3=B5es=20de=20whatsapp?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- TEST_SERVER1/api/app.js | 7 ++++--- TEST_SERVER1/whats/app.js | 4 ++++ 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/TEST_SERVER1/api/app.js b/TEST_SERVER1/api/app.js index 1a9bb2e..bc23bce 100644 --- a/TEST_SERVER1/api/app.js +++ b/TEST_SERVER1/api/app.js @@ -29,7 +29,7 @@ app.post('/api/session', async function (req, res) { console.log('__dirname: ', path.join(__dirname, '..', app_name)) - console.log(app_name, whatsappId, client_url) + console.log('app_name: ', app_name, ' | whatsappId: ', whatsappId, ' | client_url: ',client_url) const sessionsPath = path.join(__dirname, '..', 'sessions') @@ -169,7 +169,7 @@ app.post('/api/session', async function (req, res) { db = db[0].db_conf } - if (dirSessionsNumberAppDirectories.length > 0) { + // if (dirSessionsNumberAppDirectories.length > 0) { if (db && Object.keys(db).length > 0) { @@ -228,7 +228,7 @@ app.post('/api/session', async function (req, res) { console.log('Number session: ', numberSession) - } + // } dirSessionAppName = `${whatsappId}_${number}_${numberSession}_${appPort}` @@ -436,6 +436,7 @@ process.on('uncaughtException', function (err) { console.error(' '); return }); + function deletePm2Process(process_name, currPath) { pm2.connect(function (err) { if (err) { diff --git a/TEST_SERVER1/whats/app.js b/TEST_SERVER1/whats/app.js index cb1bbdb..fa85f01 100644 --- a/TEST_SERVER1/whats/app.js +++ b/TEST_SERVER1/whats/app.js @@ -21,6 +21,10 @@ const FormData = require('form-data'); // const { MessageMedia } = require('./node_modules/whatsapp-web.js/src/structures'); let whatsappWebGlobalPath = path.join(process.env.NODE_PATH, 'whatsapp-web.js', '/src/structures'); whatsappWebGlobalPath = whatsappWebGlobalPath.replace(':','') + +console.log('whatsappWebGlobalPath: ', whatsappWebGlobalPath) +console.log('process.env.NODE_PATH: ', process.env.NODE_PATH) + const { MessageMedia } = require(whatsappWebGlobalPath); const logger = require('logger')