nestwhats
Version:
A whatsapp-web.js wrapper for NestJS to create WhatsApp bots
44 lines (43 loc) • 1.28 kB
TypeScript
import { Client } from "whatsapp-web.js";
export declare enum ClientStatus {
Initializing = "initializing",
QrReceived = "qr_received",
Authenticated = "authenticated",
Ready = "ready",
Disconnected = "disconnected"
}
export interface ClientSummary {
name: string;
prefix: string;
status: ClientStatus;
statusAt: number;
qr?: string;
pushname?: string;
phone?: string;
}
export interface ClientEntry {
name: string;
client: Client;
prefix: string;
status: ClientStatus;
statusAt: number;
qr?: string;
pushname?: string;
phone?: string;
}
export declare class ClientsRegistryService {
private readonly logger;
private readonly registry;
private readonly changeListeners;
add(entry: Omit<ClientEntry, "status" | "qr" | "statusAt">): void;
updateStatus(name: string, status: ClientStatus, qr?: string): void;
updateInfo(name: string, pushname: string, phone: string): void;
subscribe(fn: () => void): () => void;
private notify;
get(name?: string): Client | undefined;
getEntry(name?: string): ClientEntry | undefined;
getAll(): ClientEntry[];
getByStatus(status: ClientStatus): ClientEntry[];
getNames(): string[];
getSummary(): ClientSummary[];
}