yayan 1 an în urmă
părinte
comite
8036473573
2 a modificat fișierele cu 7 adăugiri și 3 ștergeri
  1. 6 2
      main.js
  2. 1 1
      whatsapp-client.js

+ 6 - 2
main.js

@@ -13,7 +13,11 @@ function createWa(be, res) {
     wa.client.on('qr', async qr => {
         console.log(`be:${wa.clientId}:qr:${qr}`);
         if (res == null) {
-            await wa.client.destroy();
+            try {
+                await wa.client.destroy();
+            } catch (error) {
+                console.log(error);
+            }
             return;
         }
         if (!wa.isGenerateQr) {
@@ -45,7 +49,7 @@ function createWa(be, res) {
     });
     wa.client.on('disconnected', async (reason) => {
         console.log(`be:${wa.clientId}:Client was logged out`, reason);
-        wa.client.logout();
+        await wa.client.destroy();
         map.delete(wa.clientId);
     });
 }

+ 1 - 1
whatsapp-client.js

@@ -19,7 +19,7 @@ class WhasAppClient {
             },
         });
 
-        this.client.initialize();
+        this.client.initialize().catch(_ => _);
 
         this.client.on('authenticated', async () => {
             console.log(`be:${this.clientId}:Authenticated`);