fix: Solved problem when disconnecting from the instance the instance was deleted

This commit is contained in:
Davidson Gomes
2023-07-29 11:09:56 -03:00
parent f89c2b1f63
commit fe2b9774d8
7 changed files with 29 additions and 96 deletions

View File

@@ -135,12 +135,12 @@ export class WAStartupService {
}
private readonly logger = new Logger(WAStartupService.name);
private readonly instance: wa.Instance = {};
public readonly instance: wa.Instance = {};
public client: WASocket;
private readonly localWebhook: wa.LocalWebHook = {};
private readonly localChatwoot: wa.LocalChatwoot = {};
private readonly localSettings: wa.LocalSettings = {};
private stateConnection: wa.StateConnection = { state: 'close' };
public stateConnection: wa.StateConnection = { state: 'close' };
public readonly storePath = join(ROOT_DIR, 'store');
private readonly msgRetryCounterCache: CacheStore = new NodeCache();
private readonly userDevicesCache: CacheStore = new NodeCache();
@@ -558,6 +558,7 @@ export class WAStartupService {
this.logger.verbose('Connection update');
if (qr) {
this.logger.verbose('QR code found');
console.log('this.instance.qrcode', this.instance.qrcode);
if (this.instance.qrcode.count === this.configService.get<QrCode>('QRCODE').LIMIT) {
this.logger.verbose('QR code limit reached');