midjourney
Version:
Node.js client for the unofficial MidJourney API.
71 lines (70 loc) • 2.63 kB
TypeScript
import { MJConfig, MJMessage, LoadingHandler, MJEmit, MJInfo, MJSettings, OnModal, MJShorten, MJDescribe } from "./interfaces";
import { MidjourneyApi } from "./midjourney.api";
import WebSocket from "isomorphic-ws";
export declare class WsMessage {
config: MJConfig;
MJApi: MidjourneyApi;
ws: WebSocket;
private closed;
private event;
private waitMjEvents;
private skipMessageId;
private reconnectTime;
private heartbeatInterval;
UserId: string;
constructor(config: MJConfig, MJApi: MidjourneyApi);
private heartbeat;
close(): void;
checkWs(): Promise<void>;
onceReady(): Promise<unknown>;
reconnect(): void;
private open;
private auth;
timeout(ms: number): Promise<unknown>;
private messageCreate;
private messageUpdate;
private onInteractionSuccess;
private onReady;
private onMessageCreate;
private onMessageUpdate;
private onMessageDelete;
private parseMessage;
private continue;
private verifyHuman;
private EventError;
private done;
private processingImage;
private filterMessages;
private getEventByContent;
private getEventById;
private getEventByNonce;
private updateMjEventIdByNonce;
protected log(...args: any[]): Promise<void>;
emit(event: string, message: any): void;
private emitImage;
private emitMJ;
on(event: string, callback: (message: any) => void): void;
onSystem(event: "ready" | "messageCreate" | "messageUpdate" | "messageDelete" | "interactionCreate" | "interactionSuccess", callback: (message: any) => void): void;
private emitSystem;
once(event: string, callback: (message: any) => void): void;
remove(event: string, callback: (message: any) => void): void;
removeEvent(event: string): void;
onceInfo(callback: (message: any) => void): void;
onceSettings(callback: (message: any) => void): void;
onceMJ(nonce: string, callback: (data: any) => void): void;
private removeSkipMessageId;
private removeWaitMjEvent;
onceImage(nonce: string, callback: (data: MJEmit) => void): void;
waitImageMessage({ nonce, prompt, onmodal, messageId, loading, }: {
nonce: string;
prompt?: string;
messageId?: string;
onmodal?: OnModal;
loading?: LoadingHandler;
}): Promise<MJMessage | null>;
waitDescribe(nonce: string): Promise<MJDescribe | null>;
waitShorten(nonce: string): Promise<MJShorten | null>;
waitContent(event: string): Promise<string | null>;
waitInfo(): Promise<MJInfo | null>;
waitSettings(): Promise<MJSettings | null>;
}