soop-chat-client
Version:
SOOP Live Chat Client
71 lines (70 loc) • 3.53 kB
TypeScript
import WebSocket from 'ws';
import { TypedEmitter } from 'tiny-typed-emitter';
import { Logger } from 'Logger';
import { StreamInfoOnline } from 'SoopApiTypes';
import { IceFlag, ServiceCommand, Userflag1, Userflag2 } from 'SoopChatConstants';
import { ChannelEmoteInfo, ConnectedState, ConnectionInfo, SoopBalloon, SoopBlock, SoopChatMessage, SoopChatMessageContent } from 'SoopChatTypes';
interface SoopChatClientEvents {
join: (channelId: string) => void;
part: (channelId: string) => void;
chat: (chat: SoopChatMessage) => void;
balloon: (balloon: SoopBalloon) => void;
block: (block: SoopBlock) => void;
}
export declare class SoopChatClient extends TypedEmitter<SoopChatClientEvents> {
protected socket: WebSocket | null;
protected log: Logger;
protected _connection: ConnectionInfo | null;
protected set connection(connection: ConnectionInfo | null);
get connection(): ConnectionInfo | null;
protected _stream: StreamInfoOnline | null;
protected set stream(stream: StreamInfoOnline | null);
get stream(): StreamInfoOnline | null;
protected _emotes: Record<string, ChannelEmoteInfo>;
protected set emotes(emotes: Record<string, ChannelEmoteInfo>);
get emotes(): Record<string, ChannelEmoteInfo>;
private _connectedState;
protected set connectedState(state: ConnectedState);
get connectedState(): ConnectedState;
protected loopPingPong: NodeJS.Timeout;
protected decoder: TextDecoder;
constructor({ logging }: {
logging?: boolean | undefined;
});
protected sendPing: () => void;
connect: (userId: string, password?: string) => Promise<void>;
disconnect: () => void;
/**
* @deprecated
*/
close: () => void;
send: (serviceCommand: ServiceCommand, body: string) => boolean;
protected loadEmotes: (userId: string) => Promise<void>;
protected joinChannel: () => void;
protected processMessage: (msg: ArrayBuffer) => void;
protected onMsgJoin: (bodyParted: string[]) => void;
protected onMsgJoinPartUser: (bodyParted: string[]) => void;
protected onMsgSetUserTimeout: (bodyParted: string[]) => void;
protected onMsgChatMsg: (bodyParted: string[]) => void;
protected parseContent: (content: string) => SoopChatMessageContent[];
protected onMsgChatOgq: (bodyParted: string[]) => void;
protected onMsgOgqGift: (bodyParted: string[]) => void;
protected onMsgSetUserflag: (bodyParted: string[]) => void;
protected onMsgInoutManager: (bodyParted: string[]) => void;
protected onMsgIce: (bodyParted: string[]) => void;
protected onMsgSlowMode: (bodyParted: string[]) => void;
protected onMsgBalloon: (bodyParted: string[]) => void;
protected onMsgBalloonAd: (bodyParted: string[]) => void;
protected onMsgBalloonAdStation: (bodyParted: string[]) => void;
protected onMsgPoll: (bodyParted: string[]) => void;
protected onMsgBlockWordsList: (bodyParted: string[]) => void;
protected onMsgStreamClosed: (_: string[]) => void;
protected onMsgNoticeSystem: (bodyParted: string[]) => void;
protected onMsgNotice: (bodyParted: string[]) => void;
protected onMsgSubscriptionGift: (bodyParted: string[]) => void;
protected onMsgSubscriptionNew: (bodyParted: string[]) => void;
protected onMsgSubscription: (bodyParted: string[]) => void;
protected isUserflag: (flagName: Userflag1 | Userflag2, userflag: number) => boolean;
protected isIceflag: (flagName: IceFlag, iceflag: number) => boolean;
}
export {};