feat(RemoteAuth): v2

- Change event name: `success` -> `finish`
- Event `closed` return `token`

Co-Authored-By: Nguyễn Hồng Đức <hongducyb123@gmail.com>
This commit is contained in:
March 7th
2022-08-18 20:04:00 +07:00
parent b870b51c11
commit 9ce15990c1
5 changed files with 354 additions and 246 deletions

23
typings/index.d.ts vendored
View File

@@ -164,18 +164,29 @@ import {
// @ts-ignore
//#region Classes
export abstract class DiscordAuthWebsocket extends EventEmitter {
constructor(client?: Client, debug?: boolean, hideLog?: boolean);
public authURL?: string;
constructor(options?: DiscordAuthWebsocketOptions);
public fingerprint?: string;
public heartbeatInterval?: number;
public ws?: WebSocket;
public token?: string;
public user?: RawUserData;
public readonly exprireTime: string;
public connect(client?: Client): void;
public destroy(): void;
public generate_qr_code(fingerprint: string): void;
public on(event: 'ready', listener: (authURL: string) => void): this;
public on(event: 'success', listener: (user: RawUserData, token: string) => void): this;
public generateQR(): void;
public on(event: 'ready', listener: (fingerprint: string, authURL: string) => void): this;
public on(event: 'finish', listener: (user: RawUserData, token: string) => void): this;
public on(event: 'cancel' | 'pending', listener: (user: RawUserData) => void): this;
public on(event: 'closed', listener: (loginState: boolean) => void): this;
public on(event: 'closed', listener: (token?: string) => void): this;
public on(event: string, listener: (...args: any[]) => Awaitable<void>): this;
}
export interface DiscordAuthWebsocketOptions {
debug: boolean;
hiddenLog: boolean;
autoLogin: boolean;
failIfError: boolean;
generateQR: boolean;
}
// RPC by aiko-chan-ai
export interface RichButton {
name: string;