From 494c01be6c09d361ab7dc3f1f2b38453a7661ca8 Mon Sep 17 00:00:00 2001 From: Elysia <71698422+aiko-chan-ai@users.noreply.github.com> Date: Wed, 2 Aug 2023 23:08:14 +0700 Subject: [PATCH] Update Client.js --- src/client/Client.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/client/Client.js b/src/client/Client.js index 4619955..762469a 100644 --- a/src/client/Client.js +++ b/src/client/Client.js @@ -469,7 +469,7 @@ class Client extends BaseClient { * @returns {Promise} New Discord Token */ createToken() { - return new Promise(resolve => { + return new Promise((resolve, reject) => { // Step 1: Create DiscordAuthWebsocket const QR = new DiscordAuthWebsocket({ hiddenLog: true, @@ -482,7 +482,11 @@ class Client extends BaseClient { }); // Step 2: Add event QR.once('ready', async (_, url) => { - await this.remoteAuth(url, true); + try { + await this.remoteAuth(url); + } catch (e) { + reject(e); + } }).once('finish', (user, token) => { resolve(token); });