lilybird
Version:
A bun-first discord api wrapper written in TS
34 lines • 1.52 kB
TypeScript
import { REST } from "./http/rest.js";
import { WebSocketManager } from "#ws";
import type { CompilerOptions } from "./compiler.js";
import type { DispatchFunction } from "#ws";
import type { CacheManagerStructure, CachingOptions, ClientOptions, DebugFunction, Transformers, Application, MockClient, Listeners } from "./typings/index.js";
type GetUserType<T extends Transformers<any>> = (T["userUpdate"] & {}) extends {
handler: ((...args: infer U) => infer R);
} ? unknown extends R ? U[1] : R : never;
export declare class Client implements MockClient {
#private;
readonly rest: REST;
readonly cache: CacheManagerStructure;
readonly ws: WebSocketManager;
readonly user: GetUserType<Transformers<this>>;
readonly sessionId: string;
readonly application: Application.Structure;
protected readonly ready: boolean;
constructor(options: ClientOptions, debug?: DebugFunction);
login(token: string, dispatch?: DispatchFunction | undefined): Promise<string>;
close(): void;
ping(): Promise<{
ws: number;
rest: number;
}>;
}
export interface CreateClientOptions<T extends Transformers<any>> extends Omit<ClientOptions, "dispatch">, CompilerOptions<T> {
token: string;
listeners: Listeners<Client, T>;
caching?: CachingOptions;
debug?: DebugFunction;
}
export declare function createClient<T extends Transformers<Client> = Transformers<Client>>(options: CreateClientOptions<T>): Promise<Client>;
export {};
//# sourceMappingURL=client.d.ts.map