fix qrLogin
This commit is contained in:
parent
89de461ee5
commit
2ae6053fdb
@ -436,18 +436,13 @@ class Client extends BaseClient {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Sign in with the QR code on your phone.
|
* Sign in with the QR code on your phone.
|
||||||
* @param {boolean} debug Debug mode
|
* @param {DiscordAuthWebsocketOptions} options Options
|
||||||
* @returns {DiscordAuthWebsocket}
|
* @returns {DiscordAuthWebsocket}
|
||||||
* @example
|
* @example
|
||||||
* client.QRLogin();
|
* client.QRLogin();
|
||||||
*/
|
*/
|
||||||
QRLogin(debug = false) {
|
QRLogin(options = {}) {
|
||||||
const QR = new DiscordAuthWebsocket({
|
const QR = new DiscordAuthWebsocket(options);
|
||||||
autoLogin: true,
|
|
||||||
userAgent: this.options.http.headers['User-Agent'],
|
|
||||||
wsProperties: this.options.ws.properties,
|
|
||||||
debug,
|
|
||||||
});
|
|
||||||
this.emit(Events.DEBUG, `Preparing to connect to the gateway (QR Login)`, QR);
|
this.emit(Events.DEBUG, `Preparing to connect to the gateway (QR Login)`, QR);
|
||||||
return QR.connect(this);
|
return QR.connect(this);
|
||||||
}
|
}
|
||||||
|
@ -155,6 +155,7 @@ new DiscordAuthWebsocket({
|
|||||||
apiVersion: 9,
|
apiVersion: 9,
|
||||||
userAgent: defaultUA,
|
userAgent: defaultUA,
|
||||||
wsProperties: defaultClientOptions.ws.properties,
|
wsProperties: defaultClientOptions.ws.properties,
|
||||||
|
captchaHandler: () => new Error('Captcha Handler not found. Please set captchaHandler option.'),
|
||||||
};
|
};
|
||||||
if (typeof options == 'object') {
|
if (typeof options == 'object') {
|
||||||
if (typeof options.debug == 'boolean') this.options.debug = options.debug;
|
if (typeof options.debug == 'boolean') this.options.debug = options.debug;
|
||||||
|
2
typings/index.d.ts
vendored
2
typings/index.d.ts
vendored
@ -952,7 +952,7 @@ export class Client<Ready extends boolean = boolean> extends BaseClient {
|
|||||||
public login(token?: string): Promise<string>;
|
public login(token?: string): Promise<string>;
|
||||||
public normalLogin(username: string, password?: string, mfaCode?: string): Promise<string>;
|
public normalLogin(username: string, password?: string, mfaCode?: string): Promise<string>;
|
||||||
public switchUser(token: string): void;
|
public switchUser(token: string): void;
|
||||||
public QRLogin(debug?: boolean): DiscordAuthWebsocket;
|
public QRLogin(options?: DiscordAuthWebsocketOptions): DiscordAuthWebsocket;
|
||||||
public remoteAuth(url: string, forceAccept?: boolean): Promise<remoteAuthConfrim | undefined>;
|
public remoteAuth(url: string, forceAccept?: boolean): Promise<remoteAuthConfrim | undefined>;
|
||||||
public createToken(): Promise<string>;
|
public createToken(): Promise<string>;
|
||||||
public checkUpdate(): Promise<this>;
|
public checkUpdate(): Promise<this>;
|
||||||
|
Loading…
Reference in New Issue
Block a user