1234567891011121314151617181920212223242526272829303132333435363738394041 |
- import { v1 as uuidV1 } from 'uuid';
-
- export type MsgType = 'text' | 'audio' | 'video' | 'image' |'cmd' | 'attachment';
-
- export type ChatType = 'chat' | 'room' | 'group' | 'push';
-
- export class MsgBase {
-
- id: string = uuidV1();
-
-
- from: string;
-
-
- to: string;
-
-
- type: ChatType;
-
-
- ext: Record<string, string>;
-
-
- isValid() {
- if (!this.from || !this.to) {
- return false;
- }
-
- return true;
- }
-
- static createMsg(baseMsg: Partial<MsgBase>): MsgBase {
- const msg = new MsgBase();
- Object.assign(msg, baseMsg);
- return msg;
- }
- }
-
- export type GroupOption = {
-
- }
|