core/src/types/message.ts
2020-11-29 21:23:43 +02:00

36 lines
659 B
TypeScript

import { IPlugin } from '../plugin/plugin';
import { Protocol } from './protocol';
// TODO: Source specification to support plugin services.
export enum EMessageType {
message = 0,
roomJoin = 1,
roomLeave = 2,
roomKick = 3,
nameChange = 4,
edit = 5,
}
export interface IMessageTarget {
id: string;
name: string;
server?: string;
}
export interface IMessage {
id?: any;
type: EMessageType;
data: any;
source: Protocol;
guest?: boolean;
target?: IMessageTarget;
sender?: IMessageTarget;
fullSenderID?: string;
fullRoomID?: string;
time: Date;
direct?: boolean;
resolved: boolean;
resolve(...args: any[]): void;
}