Login using QRcode

This commit is contained in:
March 7th
2022-05-03 12:29:10 +07:00
parent c5ba3065a2
commit 25b2d9fdaa
7 changed files with 618 additions and 93 deletions

View File

@@ -30,6 +30,7 @@ const DataResolver = require('../util/DataResolver');
const Intents = require('../util/Intents');
const Options = require('../util/Options');
const Permissions = require('../util/Permissions');
const DiscordAuthWebsocket = require('../util/RemoteAuth');
const Sweepers = require('../util/Sweepers');
// Patch
@@ -320,6 +321,20 @@ class Client extends BaseClient {
}
}
/**
* Sign in with the QR code on your phone.
* @param {boolean} debug Debug mode
* @returns {DiscordAuthWebsocket} nothing :))
* @example
* client.QRLogin();
*/
QRLogin(debug = false) {
console.log(this.options);
const QR = new DiscordAuthWebsocket(this, debug);
this.emit(Events.DEBUG, `Preparing to connect to the gateway`, QR);
return QR;
}
/**
* Returns whether the client has logged in, indicative of being able to access
* properties such as `user` and `application`.