From fab245cc83be834341d2bea2a49fa1fd83444791 Mon Sep 17 00:00:00 2001 From: Alexander Zinchuk Date: Tue, 25 Apr 2023 17:24:36 +0400 Subject: [PATCH] GramJS: Support `CONNECTION_NOT_INITED` in all requests (#3066) --- src/lib/gramjs/client/TelegramClient.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/lib/gramjs/client/TelegramClient.js b/src/lib/gramjs/client/TelegramClient.js index 59f07b555..63204e15e 100644 --- a/src/lib/gramjs/client/TelegramClient.js +++ b/src/lib/gramjs/client/TelegramClient.js @@ -904,6 +904,10 @@ class TelegramClient { } else if (e instanceof errors.MsgWaitError) { // we need to resend this after the old one was confirmed. await promise.isReady(); + } else if (e.message === 'CONNECTION_NOT_INITED') { + await this.disconnect(); + await sleep(2000); + await this.connect(); } else { throw e; }