@hp4k1h5/terminordle
Version:
> multiplayer [wordle](https://www.powerlanguage.co.uk/wordle/) clone in your terminal
53 lines (52 loc) • 1.23 kB
TypeScript
import { WebSocket } from 'ws';
import { Option } from './structs';
export interface WS extends WebSocket {
user_id?: string;
session_id?: string;
is_alive?: boolean;
}
export declare enum ServerMsgType {
create = "create",
join = "join",
guess = "guess",
again = "again"
}
export declare enum ClientMsgType {
user_id = "user_id",
session_id = "session_id",
info = "info",
again = "again",
guess = "guess",
error = "error"
}
declare type MsgType = ServerMsgType | ClientMsgType;
export declare const MsgType: {
user_id: ClientMsgType.user_id;
session_id: ClientMsgType.session_id;
info: ClientMsgType.info;
again: ClientMsgType.again;
guess: ClientMsgType.guess;
error: ClientMsgType.error;
create: ServerMsgType.create;
join: ServerMsgType.join;
};
export interface Message {
type: MsgType;
user_id?: string;
session_id?: string;
content?: string | {
guess: Option[];
rem: number;
};
log?: boolean;
}
export interface ServerMessage extends Message {
type: ServerMsgType;
}
export interface ClientMessage extends Message {
type: ClientMsgType;
}
export interface User {
id: string;
}
export {};