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