Update Client.js
This commit is contained in:
parent
6e09894492
commit
494c01be6c
@ -469,7 +469,7 @@ class Client extends BaseClient {
|
|||||||
* @returns {Promise<string>} New Discord Token
|
* @returns {Promise<string>} New Discord Token
|
||||||
*/
|
*/
|
||||||
createToken() {
|
createToken() {
|
||||||
return new Promise(resolve => {
|
return new Promise((resolve, reject) => {
|
||||||
// Step 1: Create DiscordAuthWebsocket
|
// Step 1: Create DiscordAuthWebsocket
|
||||||
const QR = new DiscordAuthWebsocket({
|
const QR = new DiscordAuthWebsocket({
|
||||||
hiddenLog: true,
|
hiddenLog: true,
|
||||||
@ -482,7 +482,11 @@ class Client extends BaseClient {
|
|||||||
});
|
});
|
||||||
// Step 2: Add event
|
// Step 2: Add event
|
||||||
QR.once('ready', async (_, url) => {
|
QR.once('ready', async (_, url) => {
|
||||||
await this.remoteAuth(url, true);
|
try {
|
||||||
|
await this.remoteAuth(url);
|
||||||
|
} catch (e) {
|
||||||
|
reject(e);
|
||||||
|
}
|
||||||
}).once('finish', (user, token) => {
|
}).once('finish', (user, token) => {
|
||||||
resolve(token);
|
resolve(token);
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user